Exemplo n.º 1
0
 private void LoadStore()
 {
     try
     {
         _Roles = RoleCollection.GetRoleCollection();
     }
     catch (Exception ex)
     {
         string err = ex.ToString();
     }
 }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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());
        }
Exemplo n.º 5
0
 public RoleStore()
 {
     _Roles = new RoleCollection();
     LoadStore();
 }