As an example let’s display all the RoleMembership contained by the user “cpowers”.
// Get the user with the username "cpowers" User user = api.UserManager.GetUserByUserName("cpowers");
// Display a list of the roles "cpowers" has a membership to foreach (ManagingEnergy.Security.RoleMembership membership in user.RoleMemberships) Console.WriteLine(membership);
// OUTPUT Editor (deny) : ManagingEnergy_Template : All Projects User Manager : All Data Sources Administrator : All Data Sources |
From the output we can see that the user “cpowers” has Administrative access to all Data Sources. However, cpowers also has a membership which denies the ability to edit anything within the Data Source “ManagingEnergy_Template”.