Пример #1
0
        /// <summary>
        /// 初始化超级用户
        /// </summary>
        /// <returns></returns>
        public bool InitSuperUser(NewUserRequest request)
        {
            bool success = false;

            var super = UsersAccessor.GetSuperUser();

            string[] codes = PermissionCache.Instance.GetCodeArray();

            if (super != null)
            {
                UserManage manage = new UserManage(super);
                success = manage.ModifyTo(new UserModifyState
                {
                    Email       = request.Email,
                    Mobile      = request.Mobile,
                    Name        = request.Name,
                    Title       = request.Title,
                    UserName    = request.Username,
                    Password    = request.Password,
                    Permissions = codes
                });
            }
            else
            {
                request.Permissions = codes;
                NewUser newUser = new NewUser(request, true);
                success = newUser.Save();
            }

            return(success);
        }