Hi,

I debugged the issue and found the culprit. When creating a new user, it is
possible to specify a set of roles for the user in the 2nd step of user
creation. But it does not add those roles to the UserRoleCache although
those are written to database. When displaying the roles for the user, it
will read from the cache. The cache will have the Internal/everyone role
and it will be displayed.

When updating user roles it has the correct behavior because it clears the
cache inside the *updateRoleListOfUser* method and so once updating is done
it will read the values from the database.

*clearUserRolesCache(**UserCoreUtil.addDomainToName(userName,
getMyDomainName()));*

The fix should be done in the *addUser* method in *AbstractUserStoreManager*
class (*org.wso2.carbon.user.core*.common).

Once the new user is created, the roleList should be added to the cache.

*addToUserRolesCache(tenantId, UserCoreUtil.addDomainToName(userName,
getMyDomainName()), roleList);*

Here also we can use the clearUserRolesCache method same as in
updateRoleListOfUser but in this case it is not necessary to read again
from database as the roleList of the newly created user can be directly
added to the cache.

I'll issue the patch soon after all the testing is done.



On Sat, Sep 27, 2014 at 11:43 AM, Tharindu Edirisinghe <tharin...@wso2.com>
wrote:

> Hi Malith,
> I'm looking into this.
>
>
> On Saturday, September 27, 2014, Malith Dhanushka <mal...@wso2.com> wrote:
>
>> Hi Carbon/IS team,
>>
>> We observed [1] with patch0009 while BAM 2.5.0 testing. This was only
>> noticed with patch0009 in place and find more details in jira. please have
>> a look.
>>
>> [1] https://wso2.org/jira/browse/CARBON-14984
>>
>> Thanks
>> --
>> Malith Dhanushka
>> Software Engineer - Data Technologies
>> *WSO2, Inc. : wso2.com <http://wso2.com/>*
>> *Mobile*          : +94 716 506 693
>>
>
>
> --
>
> Tharindu Edirisinghe
> Software Engineer | WSO2 Inc
> Identity Server Team
> mobile : +94 775 181586
>
>


-- 

Tharindu Edirisinghe
Software Engineer | WSO2 Inc
Identity Server Team
mobile : +94 775 181586
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to