RADmenu Sitefinity 4.1

9 posts, 0 answers
  1. Gerrit
    Gerrit avatar
    33 posts
    Member since:
    Jul 2010

    Posted 28 Apr 2011 Link to this post

    Hi Guys,

    Since the upgrade to Sitefinity 4.1 the permissions does not work anymore in the radmenu, this is confirmed and I'm not sure when it will be fixed. So for the time being I want to create my own menu control.

    I am however having problems building the tree with all the pages to bind to the radmenu.
    I'm having difficulties getting the permissions of pages. I need to somehow check which roles have permissions to see certain pages, and based on that display the pages in the menu.

    Any help would be appreciated.
    I know how to get all the pages with this code :

    var pages = App.WorkWith().Pages().LocatedIn( Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend ).Get().ToList()

    But not sure how to check the permissions.


    Kind Regards,
    Gerrit
  2. Victor Velev
    Admin
    Victor Velev avatar
    3 posts

    Posted 28 Apr 2011 Link to this post

    Hello Gerrit,

    Please have a look at our developers section of the documentation regarding the implementation of roles and permissions. It may give you an idea how the roles and permissions are working.

    Also you can find some useful information when creating your custom navigation in this article.

    You can check below the attached code sample, showing how to get all Pages that a certain Role has View rights to. I hope it gives you a hint on how to achieve the desired functionality :

    var fluent = App.WorkWith();
    var roleManager = RoleManager.GetManager("AppRoles");
    var everyoneRole = roleManager.GetRole("Everyone");
    SecurityConfig cfg = Config.Get<SecurityConfig>();
    var permSet = cfg.Permissions[SecurityConstants.Sets.Pages.SetName];
    intactionMask = permSet.Actions[SecurityConstants.Sets.Pages.View].Value;
    var pages = fluent.Pages().Where(page => page.IsGranted(SecurityConstants.Sets.Pages.View, newGuid[] { everyoneRole.Id }, actionMask)).Get();

    All the best,

    Victor Velev
    the Telerik team

  3. Gerrit
    Gerrit avatar
    33 posts
    Member since:
    Jul 2010

    Posted 28 Apr 2011 Link to this post

    Hi Victor,

    Thank you for your reply, the developers section link gives me a 404?
    Also I tried the code below, but I'm getting an error:

    Telerik.Sitefinity.Pages.Model.PageNode, Telerik.Sitefinity.Model was not granted View in Pages for principals with IDs 00000000-0000-0000-0000-000000000000

    Not sure what that means, should I add something to the code below?

    Thanks for your quick reply!

    Kind Regards,
    Gerrit
  4. Victor Velev
    Admin
    Victor Velev avatar
    3 posts

    Posted 28 Apr 2011 Link to this post

    Hello Gerrit,

    Sorry about the wrong link. Here is the correct one.

    The error you get is caused by incorrectly set permissions. You need to set the correct Role ID's of the users who you want to have access to particular pages associated with that particular role. Please check the attached screenshot.

    I see that you've already inquired about setting permissions programmatically to the Pages page in forum post so you might want to refer to it as well, if you prefer to set these in code, not form the UI.

    You can also review the following thread which describes a similar issue.

    Kind regards,
    Victor Velev
    the Telerik team

  5. Gerrit
    Gerrit avatar
    33 posts
    Member since:
    Jul 2010

    Posted 28 Apr 2011 Link to this post

    Hi Victor,

    Thanks for the reply, although I'm still having the same problem, feeling a bit stupid not getting this right.
    I'm receiving the same error still.

    I did have one role that was not in the list in the security config, I went to the DB to get the Guid of the role and added the role to the list.
    My list look now as follow :

    <role id="02c96273-ac38-42cd-a727-111e0f0ce1ec" name="Everyone" /><br><span class="Apple-tab-span" style="white-space:pre">       </span><role id="0bb4d78b-4209-49e6-aed1-9332a07117e4" name="Anonymous" /><br><span class="Apple-tab-span" style="white-space:pre">       </span><role id="f845d881-8d1b-4133-9df5-addf095c8b02" name="Authenticated" /><br><span class="Apple-tab-span" style="white-space:pre">       </span><role id="949ea01c-d5b3-44a8-a3e7-e313213af23f" name="Owner" /><br><span class="Apple-tab-span" style="white-space:pre">       </span><role id="735f7d2b-a4c7-4f6d-9c8e-44f434f5a929" name="Administrators" /><br><span class="Apple-tab-span" style="white-space:pre">      </span><role id="236b7970-0eef-4019-8141-3a5d6c9d3ef8" name="BackendUsers" /><br><span class="Apple-tab-span" style="white-space:pre">        </span><role id="d716c573-5172-4539-8f9d-b4b8452f41d6" name="Authors" /><br><span class="Apple-tab-span" style="white-space:pre">     </span><role id="7ee5fac6-4e01-441b-bd36-034ee64b686d" name="Editors" /><br><span class="Apple-tab-span" style="white-space:pre">     </span><role id="89b19de3-112f-40cb-bf44-71d1b16dd28e" name="Designers" /><br><span class="Apple-tab-span" style="white-space:pre">       </span><role id="5b2622ff-1597-4ee0-bd6b-9d3e3aa8195d" name="Broker" />

    I am testing it with a page that is accessible for all users.

    Here is the code I'm using:

    var fluent = App.WorkWith();
                var roleManager = RoleManager.GetManager("AppRoles");
                var everyoneRole = roleManager.GetRole( "Anonymous" );
                SecurityConfig cfg = Config.Get<SecurityConfig>();
                var permSet = cfg.Permissions[SecurityConstants.Sets.Pages.SetName];
                int actionMask = permSet.Actions[SecurityConstants.Sets.Pages.View].Value;
                var pages = fluent.Pages().Where(page => page.IsGranted(SecurityConstants.Sets.Pages.View, new Guid[] { everyoneRole.Id }, actionMask)).Get().ToList();

    I've added the "ToLIst()", if I remove the "ToList()" it works, but then when I bind it to the radmenu it gives the error again.

    Kind Regards,
    Gerrit
  6. Gerrit
    Gerrit avatar
    33 posts
    Member since:
    Jul 2010

    Posted 28 Apr 2011 Link to this post

    Okay, I have a small update:

    I broke the inheritance of the my public page.
    Then I added all the roles to have view permissions, now I'm not getting that error anymore, but a new error:

    Telerik.Sitefinity.Pages.Model.PageNode with ID f669d9a7-009d-4d83-aaaa-000000000001 does not support permission set View. It supports Pages.

    Not sure what to do here, seems I'm a error magnet today!

    Kind Regards,
    Gerrit
  7. Victor Velev
    Admin
    Victor Velev avatar
    3 posts

    Posted 03 May 2011 Link to this post

    Hello Gerrit,

    Can you send me the widget so I can have a detailed look at your code.

    Greetings,
    Victor Velev
    the Telerik team
    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
  8. FlR
    FlR avatar
    8 posts
    Member since:
    Oct 2010

    Posted 19 Aug 2011 Link to this post

    I'm getting the same error. I have created a custom menu usercontrol which is retrieving the pages.

    The error is

    Telerik.Sitefinity.Pages.Model.PageNode with ID 28051aaf-ecee-4bb4-a8e4-5018fed34986 does not support permission set Anonymous. It supports Pages.


    This is the homepage id.

    What I'm using the main control menu is:

    SecurityConfig cfg = Config.Get<SecurityConfig>();
                var permSet = cfg.Permissions[SecurityConstants.Sets.Pages.SetName];
                int actionMask = permSet.Actions[SecurityConstants.Sets.Pages.View].Value;

                var firstLevelPages = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).
                        ThatArePublished()
                        .ThatBelongTo(siteNode.Id)
                        .Where(p => p.ShowInNavigation == true)
                        .Where(p=>p.IsGranted(SecurityConstants.Sets.Pages.View, listOfRolesGuids, actionMask))
                        .OrderBy(p => p.Ordinal)
                        .Get().ToList();
  9. Svetoslav Petsov
    Admin
    Svetoslav Petsov avatar
    2 posts

    Posted 22 Aug 2011 Link to this post

    Hello Flr,

     You have a mistake in the p.IsGranted() method. It should be as follows:

    .Where(p=>p.IsGranted(SecurityConstants.Sets.Pages.SetName, listOfRolesGuids, actionMask))

    The first argument defines the set of Permissions. Currently you want the Pages set but instead you are taking the View action of the Pages Set. 
    If you have any further questions, be sure to get back to me.

    Kind regards,
    Svetoslav Petsov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top