Provides the structure required to hold role meta-data. It includes role ID, name, and flag indicating whether role is mandatory or not.
Exemplo n.º 1
0
 /// <summary>
 /// Thios method will get all roles such as attorney journal etc which are configured in the catalog site collection
 /// </summary>
 /// <param name="client"></param>
 /// <returns>async Task<IList<Role>></returns>
 public async Task<IList<Role>> GetRolesAsync(Client client)
 {
     IList<Role> roles = new List<Role>();
     ListItemCollection collListItem = await Task.FromResult(spList.GetData(client, listNames.DMSRoleListName, camlQueries.DMSRoleQuery));
     if (null != collListItem && 0 != collListItem.Count)
     {
         foreach (ListItem item in collListItem)
         {
             Role tempRole = new Role();
             tempRole.Id = Convert.ToString(item[matterSettings.ColumnNameGuid], CultureInfo.InvariantCulture);
             tempRole.Name = Convert.ToString(item[matterSettings.RoleListColumnRoleName], CultureInfo.InvariantCulture);
             tempRole.Mandatory = Convert.ToBoolean(item[matterSettings.RoleListColumnIsRoleMandatory], CultureInfo.InvariantCulture);
             roles.Add(tempRole);
         }
     }
     return roles;
 }
Exemplo n.º 2
0
 /// <summary>
 /// This method will get all permissions levels that are configured for a given site collection
 /// </summary>
 /// <param name="client"></param>
 /// <returns></returns>
 public async Task<IList<Role>> GetPermissionLevelsAsync(Client client)
 {
     IList<Role> roles = new List<Role>();
     List<RoleDefinition> roleDefinitions = await Task.FromResult(search.GetWebRoleDefinitions(client));
     if (roleDefinitions.Count != 0)
     {
         foreach (RoleDefinition role in roleDefinitions)
         {
             Role tempRole = new Role();
             tempRole.Name = role.Name;
             tempRole.Id = Convert.ToString(role.Id, CultureInfo.InvariantCulture);
             roles.Add(tempRole);
         }
     }
     return roles;
 }