Adding a user to a role by hand, I mean using “Administration->System->User Management->Roles” takes effect, showing the resources allowed in “Permissions Management”, but when I do the same programatically that permissions seems not to take effect.
This is the code I’am using to do that:
After execution, the user is added correctly (It was verified in Administration->System->User Management->Roles), but I’ve permission errors, seems doesn’t take the permissions correctly, very strange.
Have you tried having two different sessions opened (one for the user and other for administrator) and verifying if the changes made in the administrator session are immediately available on the user session?
If you list the user’s roles just after the ‘addPrincipalToRole’ call, is the list correct?
Is there a ‘refresh session’ call we can use to force MwMS to update its permissions check?
I’ve tried several times in different sessions and the result is the same. Doesn’t seem a session problem. I think its a bug, since the user is added to rol using both ways, but only works fine when its added from admnistration->system …
So basically, the user isadded to the role, but that is ignored?
If, as an administrator, you remove it from the role and put it back immediately, it works?
And if the user, which I am supposing has no administrator privileges, tries to add himself manually to the role, than it works?
Could it be that function is only validated when the user has administrator rights?
So basically, the user isadded to the role, but that is ignored? Yes, but only when is added with ‘addPrincipalToRole’
And if the user, which I am supposing has no administrator privileges, tries to add himself manually to the role, than it works? No, “manually” was added by an administrator.
Could it be that function is only validated when the user has administrator rights? Supposing you are refering to ‘addPrincipalToRole’, why the user is added to rol?
Basically, the user log-in using a portlet. These portlet receive the userID as a parameter an impersonates using the parameter. Before, I check if the user belongs to tu_users role (see code above). If the user is not part of the role, is added using addPrincipalToRole. I changed the code following your recommendations in the post above. Note that the user was added correctly, it was verified in Administration->System->User Management->Roles.
“tu_users” role has permission to see some options in the left navigation panel. These options can be seen when the role is assigned using Administration->System->User Management->Roles, but I cannot see that options when the role is assigned programatically.