Programatically access users role


Author
Message
Philipp Guntermann
Philipp Guntermann
StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)StrataFrame User (249 reputation)
Group: Forum Members
Posts: 141, Visits: 263
Is there a simple way to access the rules assigned to a specified user ?

this is what i got so far:

ISecurityUser U = MicroFour.StrataFrame.Security.SecurityBasics.CurrentUser;

MicroFour.StrataFrame.Security.BusinessObjects.SFSRolesBO RolesBO = new MicroFour.StrataFrame.Security.BusinessObjects.SFSRolesBO();

RolesBO.FillAllByUser(U.UserPK);

..

thanks Smile


Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm not sure what you mean by "rule". Essentially, the RBS system works via permissions (and restrictions). The easiest way to review a permission for a user is using the GetPermission() method on the CurrentUser. However, this won't tell you all their permissions, just permission for a specific key. To get all their permissions, you'd likely need to loop through the SFSPermissionsBO and call GetPermission() for each one on the current user.

SFSPermissionsBO permBO = new SFSPermissionsBO();

permBO.FillAll(0); // Or use the most appropriate fill method for your needs

foreach (DataRow row in permBO.Rows)

{

// Get permission key

String key = row.pm_key;



// See what permission user has

PermissionInfo permInfo = SecurityBasics.CurrentUser.GetPermission(key)



// Do something with it...

}




There are some fill methods that take a user ID, so those might be more appropriate, but I'm not sure...I haven't used them yet.



However, if you are just interested in roles, you are heading the right way.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search