sitefinity 5 How check module access type

Posted by Community Admin on 04-Aug-2018 12:52

sitefinity 5 How check module access type

All Replies

Posted by Community Admin on 30-May-2013 00:00

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

Posted by Community Admin on 04-Jun-2013 00:00

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
    );

I would suggest you to review the following section from our Sitefinity documentation:

www.sitefinity.com/documentation/documentationarticles/developers-guide/deep-dive/security/permissions


Regards,
Stefani Tacheva
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed