+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / sitefinity 5 How check module access type

sitefinity 5 How check module access type

2 posts, 0 answered
  1. doug
    doug avatar
    9 posts
    Registered:
    24 Jan 2011
    30 May 2013
    Link to this post
    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
  2. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    06 Dec 2016
    04 Jun 2013
    Link to this post
    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
2 posts, 0 answered