public async Task <bool> IsInRole(Guid userIdentifier, Constants.Role role) { var result = false; var account = await GetAccount(userIdentifier); result = account.RoleId == (int)role; return(result); }
public void CreateGroupForRole(Constants.Role role, SPWeb web) { string groupName = EnumHelper.GetEnumDescription(role); SPGroup gr = FindGroupByName(groupName, web); if (gr == null) { web.SiteGroups.Add(groupName, web.Site.Owner, web.CurrentUser, ""); } }
public int GetGroupIdForRole(Constants.Role role, SPWeb web) { string groupName = EnumHelper.GetEnumDescription(role); SPGroup gr = FindGroupByName(groupName, web); if (gr == null) { throw new ArgumentException("There is no sharepoint group for role '" + groupName + "'."); } return(gr.ID); }
public async Task <bool> IsInRole(Guid userIdentifier, Constants.Role role) { return(await _authorizationService.IsInRole(userIdentifier, role)); }