Ejemplo n.º 1
0
        public Response UnAssignDataProperty(AssignDataReq request)
        {
            var result = new Response();

            try {
                _app.UnAssignData(request);
            } catch (Exception ex) {
                result.Code    = 500;
                result.Message = ex.InnerException?.Message ?? ex.Message;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public string UnAssignDataProperty(AssignDataReq request)
        {
            var result = new Response();

            try
            {
                _app.UnAssignData(request);
            }
            catch (Exception ex)
            {
                result.Code    = 500;
                result.Message = ex.InnerException?.Message ?? ex.Message;
            }

            return(JsonHelper.Instance.Serialize(Result));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 分配数据字段权限
        /// </summary>
        /// <param name="request"></param>
        public void AssignData(AssignDataReq request)
        {
            var relevances = new List <Relevance> ();

            foreach (var requestProperty in request.Properties)
            {
                relevances.Add(new Relevance {
                    Key         = Define.ROLEDATAPROPERTY,
                    FirstId     = request.RoleId,
                    SecondId    = request.ModuleCode,
                    ThirdId     = requestProperty,
                    OperateTime = DateTime.Now
                });
            }
            UnitWork.BatchAdd(relevances.ToArray());
            UnitWork.Save();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 取消數據欄位分配
 /// </summary>
 /// <param name="request"></param>
 public void UnAssignData(AssignDataReq request)
 {
     if (request.Properties == null || request.Properties.Length == 0)
     {
         if (string.IsNullOrEmpty(request.ModuleCode)) //模組為空,直接把角色的所有授權刪除
         {
             DeleteBy(Define.ROLEDATAPROPERTY, request.RoleId);
         }
         else //把角色的某一個模組許可權全部刪除
         {
             DeleteBy(Define.ROLEDATAPROPERTY, new[] {request.ModuleCode}.ToLookup(u => request.RoleId));
         }
     }
     else //按具體的id刪除
     {
         foreach (var property in request.Properties)
         {
             UnitWork.Delete<Relevance>(u => u.Key == Define.ROLEDATAPROPERTY
                                             && u.FirstId == request.RoleId
                                             && u.SecondId == request.ModuleCode
                                             && u.ThirdId == property);
         }
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 取消数据字段分配
 /// </summary>
 /// <param name="request"></param>
 public void UnAssignData(AssignDataReq request)
 {
     if (request.Properties == null || request.Properties.Length == 0)
     {
         if (string.IsNullOrEmpty(request.ModuleCode))  //模块为空,直接把角色的所有授权删除
         {
             DeleteBy(Define.ROLEDATAPROPERTY, request.RoleId);
         }
         else  //把角色的某一个模块权限全部删除
         {
             DeleteBy(Define.ROLEDATAPROPERTY, new [] { request.ModuleCode }.ToLookup(u => request.RoleId));
         }
     }
     else  //按具体的id删除
     {
         foreach (var property in request.Properties)
         {
             Repository.Delete(u => u.Key == Define.ROLEDATAPROPERTY &&
                               u.FirstId == request.RoleId &&
                               u.SecondId == request.ModuleCode &&
                               u.ThirdId == property);
         }
     }
 }