Ejemplo n.º 1
0
        public Task <OperateResultRsp> ActivateCorporation(CommonCMDReq req)
        {
            var rsp = new OperateResultRsp
            {
                OperateFlag   = false,
                OperateResult = "参数错误"
            };

            try
            {
                if (!string.IsNullOrEmpty(req.CommonCMD))
                {
                    var corp = _queryCorpRepository.Get(a => a.CorporationKeyId == req.Identify.CorporationKeyId).FirstOrDefault();
                    corp.IsDelete = false;
                    var empId = corp.Activate();

                    _repository.Commit();
                    rsp.OperateFlag   = true;
                    rsp.OperateResult = "激活成功";
                    Publish(new CorporationActivatedEvent()
                    {
                        CorpId = req.Identify.CorporationKeyId,
                        Email  = req.CommonCMD,
                        EmpId  = empId
                    });
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
            }
            return(Task.FromResult(rsp));

            // return rsp;
        }
Ejemplo n.º 2
0
        public Task <BaseListResponseDto> FindCorpRoles(CommonCMDReq req)
        {
            var rsp  = new BaseListResponseDto();
            var rows = _queryCorpRepository.Get(a => a.CorporationKeyId == req.Identify.CorporationKeyId, a => a.CorpRoles).FirstOrDefault()?.CorpRoles.ToList();

            rsp.Result      = rows?.Select(a => new { roleName = a.Name, roleId = a.KeyId }).ToList();
            rsp.OperateFlag = true;
            return(Task.FromResult(rsp));
        }
Ejemplo n.º 3
0
        public Task <BaseListResponseDto> FindDomainPermissions(CommonCMDReq req)
        {
            BaseListResponseDto rsp = new BaseListResponseDto();
            var rows = _querySubDomainRepository.Get(a => !a.IsDelete, b => b.SubDomainPermissions).ToList();

            rsp.Result = rows.Select(a => new {
                keyId      = a.KeyId,
                domainNmae = a.Name,
                action     = a.SubDomainPermissions.Where(b => b.PermissionType == Domain.Auth.Entity.PermissionCategory.Action)?.GroupBy(b => b.GroupName, c => new {
                    name = c.Name,
                    no   = c.No
                }).ToDictionary(b => b.Key, c => c),
                page = a.SubDomainPermissions.Where(b => b.PermissionType == Domain.Auth.Entity.PermissionCategory.Page)?.Select(c => new {
                    name = c.Name,
                    no   = c.No
                }).ToList()
            }).ToList();
            return(Task.FromResult(rsp));
        }
Ejemplo n.º 4
0
        public Task <BaseListResponseDto> QueryUserPermission(CommonCMDReq req)
        {
            var rsp  = new BaseListResponseDto();
            var rows = _queryEmployeeRepository.FindUserRolePermission(Guid.Parse(req.Identify.Token));

            rsp.Result = new
            {
                pages = rows.Where(a => a.PermissionType == 1)?.Select(a => new
                {
                    name = a.Name,
                    no   = a.No,
                }),
                actions = rows.Where(a => a.PermissionType == 2)?.Select(a => new
                {
                    name = a.Name,
                    no   = a.No,
                })
            };
            rsp.OperateFlag = true;
            return(Task.FromResult(rsp));
        }
Ejemplo n.º 5
0
        public async Task <ServiceResult <BaseListResponseDto> > GetRoleTree(CommonCMDReq req)
        {
            var result = await _orgProxy.FindCorpRoles(req);

            return(ServiceResult <BaseListResponseDto> .Create(true, result));
        }
Ejemplo n.º 6
0
 public Task <string> SignUp(CommonCMDReq req)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 7
0
        public async Task <ServiceResult <object> > ActivateCorporation(CommonCMDReq req)
        {
            var result = await _orgProxy.ActivateCorporation(req);

            return(ServiceResult <object> .Create(result.OperateFlag, result.OperateResult));
        }
Ejemplo n.º 8
0
        public async Task <ServiceResult <object> > DomainPermissions(CommonCMDReq req)
        {
            var result = await _authProxy.FindDomainPermissions(req);

            return(ServiceResult <object> .Create(true, result));
        }