sitefinity 5 How check module access type
How in code do I check what type of module access a given role or current user has?
example: I added role view_role1 to have view access to the module and edit_role1 for edit access.
In my custom module I want to show textboxes and update button for Edits and labels without button for View access.
Thanks.
Doug
Hello,
To get the permission, you use the GetPermission method of the manager. For example (we use blogs module in the sample):
public
void
GetPermissionForUser(
string
userName)
UserManager usersManager = UserManager.GetManager();
BlogsManager blogsManager = BlogsManager.GetManager();
Telerik.Sitefinity.Security.Model.Permission permission = blogsManager.GetPermission(
SecurityConstants.Sets.Blog.SetName,
blogsManager.GetSecurityRoot(
false
).Id,
usersManager.GetUser(userName).Id
);