Beispiel #1
0
        public void UpdateUsersToRoles(int userid, string[] roleNames)
        {
            if (_App == null)
            {
                return;
            }
            IuserService UserSrv = new userService(SessionFactoryConfigPath);
            user         mUser   = UserSrv.Getbykey(userid);

            updateRolesForUser(mUser, roleNames);
        }
Beispiel #2
0
 /// <summary>
 /// required implementation
 /// </summary>
 /// <param name="providerUserKey">required implementation</param>
 /// <param name="userIsOnline">required implementation</param>
 /// <returns>required implementation</returns>
 public user GetUser(object providerUserKey, bool userIsOnline)
 {
     if (providerUserKey is int)
     {
         IuserService UserSrv = new userService(SessionFactoryConfigPath);
         int          userID  = (int)providerUserKey;
         return(UserSrv.Getbykey(userID));
     }
     else
     {
         return(null);
     }
     //throw new Exception("have not implement.");
 }
Beispiel #3
0
        public string[] GetRolesForUser(int userid)
        {
            if (_App == null)
            {
                return(null);
            }
            IuserService UserSrv = new userService(SessionFactoryConfigPath);
            user         mUser   = UserSrv.Getbykey(userid);

            if (mUser == null || mUser.Roles == null || mUser.Roles.Count == 0)
            {
                return new string[] { }
            }
            ;
            else
            {
                return((from r in mUser.Roles where r.AppID == _App.AppID select r.name).ToArray());
            }
        }
Beispiel #4
0
        /// <summary>
        /// required implementation
        /// </summary>
        /// <param name="username">required implementation</param>
        /// <param name="deleteAllRelatedData">required implementation</param>
        /// <returns>required implementation</returns>
        public bool DeleteUser(int userid, bool deleteAllRelatedData)
        {
            IuserService UserSrv  = new userService(SessionFactoryConfigPath);
            user         TempUser = UserSrv.Getbykey(userid);

            if (TempUser == null)
            {
                return(false);
            }

            try
            {
                UserSrv.Delete(TempUser);
                UserSrv.CommitChanges();
                log.Info("Delete User: "******"Error  Delete User: " + TempUser.username, ex);
                return(false);
            }
        }