예제 #1
0
 private void LoadStore()
 {
     try
     {
         _Roles = RoleCollection.GetRoleCollection();
     }
     catch (Exception ex)
     {
         string err = ex.ToString();
     }
 }
예제 #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));
        }
예제 #3
0
파일: User.cs 프로젝트: minhchau2236/pgkh
        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);
        }
예제 #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());
        }
예제 #5
0
 public RoleStore()
 {
     _Roles = new RoleCollection();
     LoadStore();
 }