public async Task <string> Create(CreateRoleInput input) { input.CheckDataAnnotations().CheckValidResult(); await _roleDomainService.Create(input); return("新增角色信息成功"); }
public async Task <string> Create(CreateRoleInput input) { input.CheckDataAnnotations().CheckValidResult(); CheckIsAllOrg(input); //_session.CheckLoginUserDataPermision(input.DataPermissionType,"您设置的角色的数据权限大于您拥有数据权限,系统不允许该操作"); await _roleDomainService.Create(input); return("新增角色信息成功"); }
private async Task CreateAdminAndRole(long tenantId, CreateTenantInput input, DbConnection conn, DbTransaction trans) { var tenantConfig = _tenantConfigProvider.Get(); if (tenantConfig == null || tenantConfig.SuperUserPassword.IsNullOrWhiteSpace() || tenantConfig.SuperUserPassword.IsNullOrWhiteSpace()) { throw new BusinessException("获取租户默认管理员账号和密码失败"); } var permissions = await _permissionRepository.GetAllAsync(); var createRole = new CreateRoleInput() { Identification = input.Identification + "_admin", Name = "管理员", PermissionIds = permissions.Select(p => p.Id).ToArray(), DataPermissionType = DataPermissionType.AllOrg, IsAllOrg = true, Memo = "创建租户时,初始化的角色", }; var roleId = await _roleDomainService.Create(createRole, conn, trans, tenantId); var createUser = new CreateUserInput() { OrgId = null, UserName = tenantConfig.SuperUserAccount, Password = tenantConfig.SuperUserPassword, ChineseName = tenantConfig.ChineseName ?? "管理员", Memo = "创建租户时,初始化的用户", RoleIds = new[] { roleId }, Status = Common.Status.Valid }; await _userDomainService.Create(createUser, conn, trans, tenantId); }