More in this section

Forums / Developing with Sitefinity / Custom rights for custom module in 3.6?

Custom rights for custom module in 3.6?

4 posts, 0 answered
  1. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    23 Apr 2009
    Link to this post

    I'm developing a custom module (Projects) based on the demo Products custom module.

    I want to have specify some custom rights for Projects module. Projects will have Users assigned to them, also have specific Librarys. So I need, eg, to have a 'Can assign User to Project' right.

    How would I go about this?


  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    23 Apr 2009
    Link to this post
    Hi Andy,

    Generally the permissions are set using SetPermissions

    Example:

    ISecured permissions = module.SecurityRoot;  
                permissions.SetPermissions(CrudRights.View, CrudRights.Delete, "ForumUsers"); 

    To add new permissions you could inherit CrudRights class in your custom class. In this case you should use your custom class instead of CrudRights in your implementation

    Sample:

    using System; 
    using System.Collections.Generic; 
    using System.Linq; 
    using System.Web; 
    using Telerik.Security.Permissions; 
     
    /// <summary> 
    /// Summary description for MyCrudRights 
    /// </summary> 
    public class MyCrudRights :CrudRights 
        public MyCrudRights() 
        { 
        } 
     
        [LocalRight("CustomerView")] 
        public static int CustmerView 
        { 
            get 
            { 
                return 32; 
            } 
        } 


    I hope this helps.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Andy
    Andy avatar
    62 posts
    Registered:
    01 Aug 2008
    23 Apr 2009
    Link to this post
    Ok. I was confused about how the extented list of ProjectRights were extracted (from a rights-based class) and displayed as a table in the PermissionsView.

    But I've just seen the View ascx, and seen the list is hard-coded!

    Thanks for your help Ivan. I may ask more dumb questions later...
    I have a non-straightforward access control model to implement...

  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    23 Apr 2009
    Link to this post
    Hi Andy,

    Let us know if you need further assistance in this matter.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
4 posts, 0 answered