Is that possible to delete the customer portal users automatically using Custom Function ?

Is that possible to delete the customer portal users automatically using Custom Function ?

Dear Team,

The requirement is,

We have one registration form for the customer portal users to auto assign the portal permission.

If the same user is requesting to change the portal permission. I have to change the old permission to current requested permissions. 
How we can achieve this ?

Because right now we are using the default functionality in settings to change the permissions as per the request.

But I need a automation 

For Example,

User Name           -    Permission [Portal Permission]

Irfan                      -     Assistant Manager 

Requesting the access for the "Manager" Permission.

Can we change the Old Permission to New permission using custom function [deluge] ?

Or Else,

Can we delete the Old Permission Access automatically and assigning the New Permission Access using custom function [deluge]?

Suggest the better solution for this.

Thank You.