Forum Discussion

FabioG's avatar
FabioG
Contributor
26 days ago

Filter Members by Security

So we have the GetBaseMembers method (or the GetChildren, or the GetDescendant or event the GetMember) that would return instances of the Member class.

What is not clear (at least to me) is how I could filter returned members based on security.

I could set Nobody in all the member Security's fields of a specific member, but it keeps on being returned by (for instance) the GetBaseMembers.

I'm wondering how I could get only visible members, applying a filter that won't return them from the call.

Also, it would be nice to know, given a member, if it can be seen, read or written.

Two ways to get the same result, for different scopes.

Thanks

FabioG

3 Replies

  • RobbSalzmann's avatar
    RobbSalzmann
    Valued Contributor II

    If you're logged in as an administrator, member security won't apply.  This got me confused before, just in case...

     

  • MarcusH's avatar
    MarcusH
    Valued Contributor

    You can write a custom member list that gets all the members. Read through each member and get the Read and Write groups (I am assuming you are wanting this for the Entity dimension) then check if the current user is in those groups using the BRApi.Security.Authorization.IsUserInGroup call. As RobbSalzmann​ says, you will need to check if the user is an Administrator and if they have access to the AdministerApplication or ViewAllData roles.

    • FabioG's avatar
      FabioG
      Contributor

      Hi MarcusH​ ,

      this would be really really slow, suppose I have hundreds/thousands of members and I want to populate a Combo: I should loop through all of them and, for each one, check their groups.

      I suppose that, just like stated by RobbSalzmann​ , when you're not an administrator, returned data is natively filtered, so the problem I exposed is not actually a problem.

      Thanks

      FabioG