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

Forums / General Discussions / Does Fluent respect Access Levels?

Does Fluent respect Access Levels?

5 posts, 2 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    16 Dec 2010
    Link to this post
    If I use the fluent API to get my pages...is it giving me all pages or just pages that my user has access to see.

    I would ASSUME all pages, so if that's the case, how do I filter it?

    Thanks
    Steve :)
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    16 Dec 2010
    Link to this post
    Hi Steve,

    You get all pages. Each PageNode is ISecured object, so you can check the permissions for a given role/user

    var pn = man.GetPageNode(pageNode.Id);
    var granted = pn.IsGranted(SecurityConstants.Sets.Pages.SetName, SecurityConstants.Sets.Pages.View);
    //option 2
    var perm = man.GetPermission(SecurityConstants.Sets.Pages.SetName, pn.Id, SecurityManager.GetCurrentUserId());
     
    // get the permission set
     
    var cs = pn.Permissions.Where(p => p.IsGranted(SecurityConstants.Sets.Pages.SetName, SecurityConstants.Sets.Pages.View));


    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    16 Dec 2010
    Link to this post
    Ahh thanks :)

    Do you think this could be perhaps wrapped into the fluent api somehow, like a Where().HasAccess() or something?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    16 Dec 2010
    Link to this post
    Hello Steve,

    I will put this as a request for future implementation in the fluent api methods.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    16 Dec 2010
    Link to this post
    Thanks Ivan :)
5 posts, 2 answered