RoleMask GetMask(IDbUserRoleAndGroupProvider.UserRoles roles) { var mask = RoleMask.None; if (roles.IsUser || authorizationOptions.AllowAllAuthenticatedUsers) { mask |= RoleMask.User; } if (roles.IsAdmin) { mask |= RoleMask.Admin; } if (roles.IsSuper) { mask |= RoleMask.Super; } if (roles.IsIdentified) { mask |= RoleMask.Identified; } if (roles.IsFederated) { mask |= RoleMask.Federated; } return(mask); }
IDbUserRoleAndGroupProvider.UserDbEntitlements HydrateEntitlements(SqlMapper.GridReader grid) { var roles = grid.Read <IDbUserRoleAndGroupProvider.UserRoles>().FirstOrDefault(); var groups = grid.Read <GroupNameRecord>().Select(r => r.GroupName); if (roles == null) { roles = new IDbUserRoleAndGroupProvider.UserRoles(); } return(new IDbUserRoleAndGroupProvider.UserDbEntitlements { Roles = roles, Groups = groups }); }