Exemplo n.º 1
0
 public Privilege(MasterEnum master, int masterValue, AccessEnum access, int accessValue)
 {
     Master      = master.ToString();
     MasterValue = masterValue;
     Access      = access.ToString();
     AccessValue = accessValue;
 }
Exemplo n.º 2
0
        public NFMT.Common.ResultModel Submit(UserModel user, IModel obj, ITaskProvider taskProvider, MasterEnum masterEnum)
        {
            ResultModel result = new ResultModel();

            //提交审核
            NFMT.WorkFlow.BLL.FlowMasterBLL flowMasterBLL = new NFMT.WorkFlow.BLL.FlowMasterBLL();
            result = flowMasterBLL.Get(user, (int)masterEnum);
            if (result.ResultStatus != 0)
                return result;
            NFMT.WorkFlow.Model.FlowMaster flowMaster = result.ReturnValue as NFMT.WorkFlow.Model.FlowMaster;

            NFMT.WorkFlow.Model.DataSource source = new NFMT.WorkFlow.Model.DataSource()
            {
                BaseName = obj.DataBaseName,
                TableCode = obj.TableName,
                DataStatus = NFMT.Common.StatusEnum.待审核,
                RowId = obj.Id,
                ViewUrl = flowMaster.ViewUrl,
                EmpId = user.EmpId,
                ApplyTime = DateTime.Now,
                ApplyTitle = string.Empty,
                ApplyMemo = string.Empty,
                ApplyInfo = string.Empty,
                ConditionUrl = flowMaster.ConditionUrl,
                RefusalUrl = flowMaster.RefusalUrl,
                SuccessUrl = flowMaster.SuccessUrl,
                DalName = obj.DalName,
                AssName = obj.AssName
            };

            result = taskProvider.Create(user,obj);
            if (result.ResultStatus != 0)
                return result;

            NFMT.WorkFlow.Model.Task task = result.ReturnValue as NFMT.WorkFlow.Model.Task;
            if (task == null)
            {
                result.ResultStatus = -1;
                result.Message = "创建任务失败";
                return result;
            }
            task.MasterId = flowMaster.MasterId;

            NFMT.WorkFlow.FlowOperate flowOperate = new NFMT.WorkFlow.FlowOperate();
            result = flowOperate.AuditAndCreateTask(user, obj, flowMaster, source, task);

            return result;
        }
Exemplo n.º 3
0
 /// <summary>
 /// 获取AccessValue的列表
 /// </summary>
 /// <param name="query"></param>
 /// <param name="master">主体对象类型(角色或者用户)</param>
 /// <param name="access">领域对象(菜单或者按钮)</param>
 /// <param name="masterValues">主体对象Id</param>
 /// <returns></returns>
 public static List <int> GetAccessValueList(this IQueryable <Privilege> query, MasterEnum master, AccessEnum access, params int [] masterValues)
 {
     return(Get(query, master, access, masterValues).Select(s => s.AccessValue).ToList());
 }
Exemplo n.º 4
0
 /// <summary>
 /// 根据权限对象(Master)及功能对象(Access)获取Privilege的列表
 /// </summary>
 /// <param name="query"></param>
 /// <param name="master">主体对象类型(角色或者用户)</param>
 /// <param name="access">领域对象(菜单或者按钮)</param>
 /// <param name="masterValues">主体对象Id</param>
 /// <returns></returns>
 public static IQueryable <Privilege> Get(this IQueryable <Privilege> query, MasterEnum master, AccessEnum access, params int[] masterValues)
 {
     return(query.Where(x => x.Master == master.ToString() && x.Access == access.ToString() && masterValues.Contains(x.MasterValue)));
 }
Exemplo n.º 5
0
        /// <summary>
        /// 获取授权的模块操作Id列表
        /// </summary>
        /// <param name="master"></param>
        /// <param name="masterValue"></param>
        /// <returns></returns>
        public async Task <AuthorizeModuleOperateIdsResponse> GetAuthorizeModuleOperateIds(MasterEnum master, int masterValue)
        {
            using (_db)
            {
                AuthorizeModuleOperateIdsResponse response = new AuthorizeModuleOperateIdsResponse();
                response.ModuleIds = await _db.Privilege.Get(master, AccessEnum.Module, masterValue).Select(s => s.AccessValue).ToListAsync();

                response.OperateIds = await _db.Privilege.Get(master, AccessEnum.Operate, masterValue).Select(s => s.AccessValue).ToListAsync();

                return(response);
            }
        }