Example #1
0
        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);
        }
Example #2
0
        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, "");
            }
        }
Example #3
0
        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);
        }
Example #4
0
 public async Task <bool> IsInRole(Guid userIdentifier, Constants.Role role)
 {
     return(await _authorizationService.IsInRole(userIdentifier, role));
 }