private void LoadStore() { try { _Roles = RoleCollection.GetRoleCollection(); } catch (Exception ex) { string err = ex.ToString(); } }
public RoleCollection GetRolesForUser(string userName) { //RoleCollection Results = new RoleCollection(); //foreach (Role r in _Roles) //{ // if (r.AssignedUsers.Contains(userName)) // Results.Add(r); //} //return Results; return(RoleCollection.GetRoleCollection(userName)); }
public RoleCollection GetRolesNotBelongTo() { PSCPortal.Framework.Database database = new PSCPortal.Framework.Database("PSCPortalConnectionString"); RoleCollection result = new RoleCollection(); using (DbConnection connection = database.GetConnection()) { DbCommand command = GetRolesNotBelongToCommand(database); command.Connection = connection; connection.Open(); DbDataReader reader = command.ExecuteReader(); while (reader.Read()) { Role item = new Role(reader); result.Add(item); } } return(result); }
public override string[] GetRolesForUser(string username) { List <string> roles = new List <string>(); if (username.ToLower() != "psc") { PSCPortal.Security.User user = PSCPortal.Security.UserCollection.GetUserCollection().Single <PSCPortal.Security.User>(u => u.Name == username); RoleCollection rolesOfUser = user.GetRolesBelongTo(); foreach (Role role in rolesOfUser) { roles.Add(role.Name); } } if (username.ToLower() == "psc") { roles.Add(System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"].ToString()); } return(roles.ToArray()); }
public RoleStore() { _Roles = new RoleCollection(); LoadStore(); }