[Carbon-dev] Deleting a User's Profile in Registry

Prabath Siriwardena prabath at wso2.com
Thu Mar 25 23:09:09 PDT 2010


+1 for the first approach - IMHO it won't affect any current usages...

Remove the registry user profiles - remove all the associated resources 
only if not further associations are there with those.

Thanks & regards.
-Prabath


Dimuthu Leelarathne wrote:
> Hi all,
>
> I am fixing this issue - https://wso2.org/jira/browse/CARBON-6977. 
> There are two approaches to fixing this.
>
> Approach 1 - This MAY affect some products depending on usage
> =======
> When we delete a user from the database we delete his profile in 
> registry as follows.
>
>             String path = RegistryConstants.PROFILES_PATH + userName;
>             if (registry.resourceExists(path)) {
>                 registry.delete(path);
>             }
> Change the above code to below.
>
>             String path = RegistryConstants.PROFILES_PATH + userName;
>             if (registry.resourceExists(path)) {
>                 Association[] associations = 
> registry.getAllAssociations(path);
>                 for(Association association : associations) {
>                     String destinationPath = 
> association.getDestinationPath();
>                     String sourcePath = association.getSourcePath();
>                     String targetPath = null;
>                     if(!sourcePath.equals(path)) {
>                         targetPath = sourcePath;
>                     }else{
>                         targetPath = destinationPath;
>                     }
>                     if(registry.getAllAssociations(targetPath).length 
> == 0){
>                         registry.delete(destinationPath);
>                     }
>                 }
>                 registry.delete(path);
>             }
>
> Approach 2 - This effects IS and ????? other products depending on usage.
> =======
> Change all code to store the resources under 
> "RegistryConstants.PROFILES_PATH + userName" and simply delete the 
> "RegistryConstants.PROFILES_PATH + userName". Deletes everything. 
> Simple fix on my end. Drastic changes to others.
>
> My question what to execute - "Approach 1" or "Approach 2"?
>
> Thanks,
> DimuthuL
>
>




More information about the Carbon-dev mailing list