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

Forums / Developing with Sitefinity / Generic Content Based Module Not Hidden in Menu

Generic Content Based Module Not Hidden in Menu

4 posts, 0 answered
  1. Shane
    Shane avatar
    28 posts
    Registered:
    27 Jul 2008
    07 Nov 2008
    Link to this post
    Hi,

    I have implemented security for my custom module. This module is using the framework of the generic based content module.

    I have set a user with a role that doesn't have permission to even view modules (custom one included). But my custom module (and Newsletter) are still in the menu when I click the modules link.

    I want my module to not be shown if I don't have permissions to see it. Currently, if a user clicks on the link for the custom module a security exception is thrown - this is good, but a user shouldn't even see the link at all?

    Can you help?

    Thanks,

    Shane
  2. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    10 Nov 2008
    Link to this post
    Hello Shane,

    You were able to see the Newsletters module because permissions for it were implemented in the next Sitefinity version - 3.5. As to your custom module, we would need more information about the implementation. How do you set the permissions? Is there a Permissions link in your module? If yes, do the permissions work - if you grant permissions to the user, is s/he able to successfully access and use your custom module?

    What is your module - Intra-Site or Pluggable? If it is an Intra-Site module, you could make sure you have correctly implemented permissions by checking the following example in our Developers Manual: Secured Intra-Site Module.

    If it is a pluggable module, we just made an example of how to implement Security in a pluggable module. The example is not yet added to the manual but it uses the Products module as part of the series of building a Pluggable module: Products Pluggable Module. I have attached the example to this thread.

    Here is more information about implementing Security in the attached example:
    • The module class (Telerik.Samples.Products.ProductsModule) should inherit from Telerik.Security.Permissions.SecuredModule base class. This class implements the ISecured interface.
    • In the manager class (Telerik.Samples.Products.ProductsManager), you should implement a SecurityRoots dictionary. This SecurityRoots should persist an ID (GUID) for every secured object. When building modules this means one for each data provider.
    • When setting permissions through the UI, you should use the PermissionSet control.
    • When checking for user permissions, do this through the manager by calling GetPermission() method.

    Hope this helps.


    Best wishes,
    Sonya
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Shane
    Shane avatar
    28 posts
    Registered:
    27 Jul 2008
    10 Nov 2008
    Link to this post
    As to your custom module, we would need more information about the implementation. How do you set the permissions? Is there a Permissions link in your module? If yes, do the permissions work - if you grant permissions to the user, is s/he able to successfully access and use your custom module? 

    --

    Yes permissions are implemented as mentioned in your recently published document on 'implementing permissions for a module based on a generic content module'

    I was under the impression that all security / permission related stuff would be handled for me?

    Help please?

    Shane
  4. Sonya
    Sonya avatar
    231 posts
    Registered:
    24 Sep 2012
    11 Nov 2008
    Link to this post
    Hello Shane,

    Yes, your impression is correct - you should not need to take care of permissions and security of the module - the implementation should do. Since you do experience problems, you probably need to review the code. The blog post you are referring to provides only guidelines, and not the complete solution. If you have used just that code, please use the code I sent to you so that you successfully implement permissions. If you have added some custom implementation of yours, then please use the module I added for reference so that you make sure you have correctly implemented permissions.

    Kind regards,
    Sonya
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
4 posts, 0 answered