コード例 #1
0
        public string GetFilterByQuery(QueryCondition qc)
        {
            if (string.IsNullOrEmpty(qc.WhereClause))
            {
                qc.WhereClause = "1 = 1";
            }

            var addition = string.IsNullOrEmpty(qc.WhereClause) ? "1 = 1" : qc.WhereClause;

            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin", "AdminFormQuery", "WorkflowQueryAdmin") == false)
            {
                ConnectiveSqlClauseCollection cscc = WfAclAdapter.Instance.GetAclQueryConditionsByUser(DeluxeIdentity.CurrentUser.ID);

                string condition = "RESOURCE_ID IN (SELECT RESOURCE_ID FROM WF.ACL WHERE " + cscc.ToSqlString(TSqlBuilder.Instance) + ")";

                //检查是否具有分类授权
                WfApplicationAuthCollection authInfo = WfApplicationAuthAdapter.Instance.GetUserApplicationAuthInfo(DeluxeIdentity.Current.User);
                var cateCondition = authInfo.GetApplicationAndProgramBuilder("APPLICATION_NAME", "PROGRAM_NAME_MCS").ToSqlString(TSqlBuilder.Instance);
                if (string.IsNullOrEmpty(cateCondition) == false)
                {
                    condition = "(" + condition + " OR " + cateCondition + ")";
                }

                addition += " AND " + condition;

                qc.WhereClause = addition;
            }

            return(qc.WhereClause);
        }
コード例 #2
0
        private List <AppListItem> GetApplicationsByCurrentUser()
        {
            List <AppListItem> applications = new List <AppListItem>();

            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
            {
                var defaultApp = WfProcessDescriptionCategoryAdapter.Instance.Load(p => p.AppendItem("ID", "", "<>"));
                foreach (var item in defaultApp)
                {
                    AppListItem obj = new AppListItem(item.Name);
                    if (!applications.Exists(a => a.Name == obj.Name))
                    {
                        applications.Add(obj);
                    }
                }
            }

            IRole[] roles = RolesDefineConfig.GetConfig().GetRolesInstances("DesignerRoleMatrix");
            foreach (var role in roles)
            {
                AppendApplicationName(role, applications);
            }

            AppListItem other = new AppListItem("其它");

            applications.Add(other);
            return(applications);
        }
コード例 #3
0
        /// <summary>
        /// 创建带分支流程的模版。为了测试XElement序列化,里面需要包含角色、资源、条件等内容
        /// </summary>
        /// <returns></returns>
        public static IWfProcessDescriptor CreateProcessDescriptorForXElementSerialization()
        {
            IWfProcessDescriptor processDesp = CreateSimpleProcessDescriptorWithBranchTemplate();

            IWfActivityDescriptor normalActivity = processDesp.Activities["NormalActivity"];

            string roleDesp = RolesDefineConfig.GetConfig().RolesDefineCollection["testRole"].Roles;

            OguRole role = new OguRole(roleDesp);

            WfRoleResourceDescriptor roleResource = new WfRoleResourceDescriptor(role);

            normalActivity.EnterEventReceivers.Add(roleResource);

            WfDynamicResourceDescriptor dynResource = new WfDynamicResourceDescriptor();

            dynResource.Condition.Expression = "Leader";
            normalActivity.LeaveEventReceivers.Add(dynResource);

            processDesp.CancelEventReceivers.Add(dynResource);

            WfRelativeLinkDescriptor relLink = new WfRelativeLinkDescriptor("TestUrl");

            relLink.Category = "Test";
            relLink.Url      = "http://localhost/www.baidu.com";

            processDesp.RelativeLinks.Add(relLink);

            return(processDesp);
        }
コード例 #4
0
ファイル: SearchList.aspx.cs プロジェクト: wooln/AK47Source
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cache.SetNoStore();

            ExceptionHelper.TrueThrow(this.Keywords.Count == 0, "请输入搜索条件");
            ExceptionHelper.TrueThrow(this.Content.Length > 128, "搜索条件字数过多");

            if (!IsPostBack)
            {
                UserSettings settings = UserSettings.GetSettings(DeluxeIdentity.CurrentUser.ID);
                this.GridQuery.PageSize          = settings.GetPropertyValue("CommonSettings", "SearchPageSize", 10);
                this.LiteralApplicationName.Text = "全部应用";
                //Note:应用名称显示注销
                //this.LiteralApplicationName.Text = string.Empty == ApplicationName ? "全部应用" : Server.HtmlEncode(ApplicationInfoConfig.GetConfig().Applications[ApplicationName].Description);
                this.LabelContent.Text = Server.HtmlEncode(this.Content);

                string where = "1 = 1";

                if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin") == false)
                {
                    ConnectiveSqlClauseCollection cscc = WfAclAdapter.Instance.GetAclQueryConditionsByUser(DeluxeIdentity.CurrentUser.ID);

                    string resourceIDList = string.Format("SELECT RESOURCE_ID FROM WF.ACL WHERE {0}", cscc.ToSqlString(TSqlBuilder.Instance));

                    where = string.Format("{0} AND ACI.RESOURCE_ID IN ({1})", where, resourceIDList);
                }


                if (keywords.Count > 0)
                {
                    StringBuilder queryString = new StringBuilder();

                    for (int i = 0; i < keywords.Count; i++)
                    {
                        if (i > 0)
                        {
                            queryString.Append(" AND ");
                        }

                        queryString.Append('"');
                        queryString.Append(keywords[i].Replace("\"", "\"\""));
                        queryString.Append('"');
                    }
                    where            = string.Format("{0} AND CONTAINS(ACI.*, {1})", where, TSqlBuilder.Instance.CheckQuotationMark(queryString.ToString(), true));
                    queryValue.Value = TSqlBuilder.Instance.CheckQuotationMark(queryString.ToString(), true);
                }

                whereCondition.Value = where;


                //分页控件赋总条目数需要在这个时候给,只能显式的绑定一下来通过数据源Select,由于数据源绑定了分页控件的参数,分页控件初始化后还会再查一次,这样会导致多查一次。
                //或许今后在了解分页控件的技术支持下,能解决这个问题---by RexCheng
            }

            _DataSet = SearchFullData.Instance.SearchFullDataByQuery(queryValue.Value);
        }
コード例 #5
0
        private void ExecuteQuery()
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
            string appName = string.IsNullOrEmpty(txtApplicationName.Text) == true ? "全部" : txtApplicationName.Text;

            if (appName.IsNotEmpty())
            {
                if ("全部" == appName)
                {
                    if (!RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
                    {
                        InSqlClauseBuilder inBuilder = new InSqlClauseBuilder();
                        inBuilder.AppendItem(AllApplicationNames());
                        builder.AppendItem("APPLICATION_NAME", inBuilder.ToSqlStringWithInOperator(TSqlBuilder.Instance), "", true);
                    }
                }
                else
                {
                    if ("其它" == appName)
                    {
                        builder.AppendItem("APPLICATION_NAME", " ");
                    }
                    else
                    {
                        builder.AppendItem("APPLICATION_NAME", appName);
                    }
                }
            }

            if (!string.IsNullOrEmpty(txtProgramName.Text))
            {
                builder.AppendItem("PROGRAM_NAME", "%" + TSqlBuilder.Instance.CheckQuotationMark(txtProgramName.Text, false) + "%", "like");
            }

            if (!string.IsNullOrEmpty(txtProcessKey.Text))
            {
                builder.AppendItem("PROCESS_KEY", "%" + TSqlBuilder.Instance.CheckQuotationMark(txtProcessKey.Text, false) + "%", "like");
            }

            if (!string.IsNullOrEmpty(txtProcessName.Text))
            {
                builder.AppendItem("PROCESS_NAME", "%" + TSqlBuilder.Instance.CheckQuotationMark(txtProcessName.Text, false) + "%", "like");
            }

            if (!string.IsNullOrEmpty(ddlEnabled.SelectedValue))
            {
                builder.AppendItem("ENABLED", TSqlBuilder.Instance.CheckQuotationMark(ddlEnabled.SelectedValue, false));
            }

            builder.AppendTenantCode();

            this.BindGrid(builder);
        }
コード例 #6
0
ファイル: SearchList.aspx.cs プロジェクト: wooln/AK47Source
        protected string GetNormalizedUrl(string appCodeName, string progCodeName, string url)
        {
            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
            {
                NameValueCollection reqParams = UriHelper.GetUriParamsCollection(url);

                reqParams["mode"] = "Admin";

                url = UriHelper.CombineUrlParams(url, reqParams);
            }

            return(UserTask.GetNormalizedUrl(appCodeName, progCodeName, url));
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //检查是否有系统管理员权限
            ExceptionHelper.FalseThrow(DeluxePrincipal.Current.IsInRole(RolesDefineConfig.GetConfig().RolesDefineCollection["ProcessAdmin"].Roles), "你没有查看此页的权限");
            Response.Cache.SetNoStore();

            if (!IsPostBack)
            {
                if (Request.QueryString.GetValue("mode", TaskStatus.Ban).Equals(TaskStatus.Ban))
                {
                    ShowToDoList();
                }
            }
        }
コード例 #8
0
        protected void GridViewFormQuery_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                if (this.GridViewFormQuery.ExportingDeluxeGrid)
                {
                    e.Row.Cells[8].Visible = false;
                }
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                UserTaskCommon.SetRowStyleWhenMouseOver(e.Row);

                AppCommonInfoProcess entity = (AppCommonInfoProcess)e.Row.DataItem;

                UserTask userTask = new UserTask();

                if (this.GridViewFormQuery.ExportingDeluxeGrid)
                {
                    e.Row.Cells[1].Text = EnumItemDescriptionAttribute.GetAttribute(entity.Emergency).ShortName;

                    e.Row.Cells[2].Text = Server.HtmlEncode(entity.Subject).ToString().Replace(" ", "&nbsp;");
                    //e.Row.Cells[8].Visible = false;
                }
                else
                {
                    e.Row.Cells[1].Text = UserTaskCommon.GetEmergencyImageHtml(entity.Emergency);

                    string url = entity.Url;

                    if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
                    {
                        NameValueCollection reqParams = UriHelper.GetUriParamsCollection(entity.Url);

                        reqParams["mode"] = "Admin";

                        url = UriHelper.CombineUrlParams(entity.Url, reqParams);
                    }

                    //title
                    userTask.Url             = url;
                    userTask.SourceID        = entity.ResourceID;
                    userTask.ApplicationName = entity.ApplicationName;
                    userTask.TaskTitle       = entity.Subject;

                    e.Row.Cells[2].Text = UserTaskCommon.GetTaskURL(userTask);
                }
            }
        }
コード例 #9
0
        private static WfApplicationAuth PrepareData(string appName, string progName)
        {
            WfApplicationAuth auth = new WfApplicationAuth();

            auth.ApplicationName = appName;
            auth.ProgramName     = progName;
            auth.AuthType        = WfApplicationAuthType.FormAdmin;

            OguRole role = new OguRole(RolesDefineConfig.GetConfig().RolesDefineCollection["testRole"].Roles);

            auth.RoleID          = role.ID;
            auth.RoleDescription = role.FullCodeName;

            return(auth);
        }
コード例 #10
0
        /// <summary>
        /// 用户是否是流程管理员
        /// </summary>
        /// <param name="user"></param>
        /// <param name="process"></param>
        /// <returns></returns>
        public static bool IsProcessAdmin(IUser user, IWfProcess process)
        {
            user.NullCheck("user");
            process.NullCheck("process");

            bool result = RolesDefineConfig.GetConfig().IsCurrentUserInRoles(user, "ProcessAdmin");

            if (result == false)
            {
                result = WfApplicationAuthAdapter.Instance.GetUserApplicationAuthInfo(DeluxeIdentity.CurrentUser).Contains(
                    process.Descriptor.ApplicationName, process.Descriptor.ProgramName, WfApplicationAuthType.FormAdmin);
            }

            return(result);
        }
コード例 #11
0
        protected override bool IsAuthorized(HttpActionContext actionContext)
        {
            bool result = (this.Enabled == false || RolesDefineConfig.GetConfig().Enabled == false);

            if (result == false)
            {
                DeluxePrincipal pricipal = actionContext.RequestContext.Principal as DeluxePrincipal;

                if (pricipal != null)
                {
                    result = this.IsAuthorized(pricipal, this.Roles);
                }
            }

            return(result);
        }
コード例 #12
0
        /// <summary>
        /// 是否是流程的管理员
        /// </summary>
        /// <param name="process"></param>
        /// <param name="user"></param>
        /// <returns></returns>
        public static bool GetIsProcessAdmin(this IWfProcess process, IUser user)
        {
            bool result = false;

            if (process != null && user != null)
            {
                result = RolesDefineConfig.GetConfig().IsCurrentUserInRoles(user, "ProcessAdmin");

                if (result == false)
                {
                    result = WfApplicationAuthAdapter.Instance.GetUserApplicationAuthInfo(user).Contains(
                        process.Descriptor.ApplicationName, process.Descriptor.ProgramName, WfApplicationAuthType.FormAdmin);
                }
            }

            return(result);
        }
コード例 #13
0
ファイル: FormQuery.cs プロジェクト: HarveyHuBJ/AK47Source
        public string GetFilterByQuery(QueryCondition qc)
        {
            if (string.IsNullOrEmpty(qc.WhereClause))
            {
                qc.WhereClause = "1 = 1";
            }

            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin", "AdminFormQuery", "WorkflowQueryAdmin") == false)
            {
                ConnectiveSqlClauseCollection cscc = WfAclAdapter.Instance.GetAclQueryConditionsByUser(DeluxeIdentity.CurrentUser.ID);

                string resourceIDList = string.Format("SELECT RESOURCE_ID FROM WF.ACL WHERE {0}", cscc.ToSqlString(TSqlBuilder.Instance));

                qc.WhereClause = string.Format("{0} AND RESOURCE_ID IN ({1})", qc.WhereClause, resourceIDList);
            }

            return(qc.WhereClause);
        }
コード例 #14
0
        private static bool GetIsProcessAdmin(IWfProcess process, string userID)
        {
            bool result = false;

            if (userID.IsNotEmpty())
            {
                OguUser user = new OguUser(userID);

                result = RolesDefineConfig.GetConfig().IsCurrentUserInRoles(user, "ProcessAdmin");

                if (result == false)
                {
                    result = WfApplicationAuthAdapter.Instance.GetUserApplicationAuthInfo(user).Contains(
                        process.Descriptor.ApplicationName, process.Descriptor.ProgramName, WfApplicationAuthType.FormAdmin);
                }
            }

            return(result);
        }
コード例 #15
0
        private static void AppendApplicationName(IRole role, List <AppListItem> appList)
        {
            SOARolePropertyRowCollection allRows = SOARolePropertiesAdapter.Instance.GetByRole(role);
            SOARolePropertyRowCollection rows    = allRows;

            if (!RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin"))
            {
                rows = allRows.Query(r => r.Operator == DeluxeIdentity.Current.User.LogOnName);
            }

            foreach (var row in rows)
            {
                string      appName = row.Values.GetValue("ApplicationName", string.Empty);
                AppListItem obj     = new AppListItem(appName);
                if (!appList.Exists(a => a.Name == obj.Name))
                {
                    appList.Add(obj);
                }
            }
        }
コード例 #16
0
        public void OguRoleCollectionSerializationTest()
        {
            JSONSerializerExecute.RegisterConverter(typeof(OguApplicationConverter));
            JSONSerializerExecute.RegisterConverter(typeof(OguRoleConverter));

            IRole[] testRoles = DeluxePrincipal.GetRoles(RolesDefineConfig.GetConfig().RolesDefineCollection["testRole"].Roles);

            OguRoleCollection roles = new OguRoleCollection(testRoles);

            string serializedData = JSONSerializerExecute.Serialize(roles);

            Console.WriteLine(serializedData);

            OguRoleCollection deserializedData = JSONSerializerExecute.Deserialize <OguRoleCollection>(serializedData);

            for (int i = 0; i < roles.Count; i++)
            {
                ValidatePermissionObject(roles[i], deserializedData[i]);
            }
        }
コード例 #17
0
        private static string[] AllApplicationNames()
        {
            List <string> appList = new List <string>();

            IRole[] roles = RolesDefineConfig.GetConfig().GetRolesInstances("DesignerRoleMatrix");
            foreach (var role in roles)
            {
                SOARolePropertyRowCollection allRows = SOARolePropertiesAdapter.Instance.GetByRole(role);
                SOARolePropertyRowCollection rows    = allRows.Query(r => r.Operator == DeluxeIdentity.Current.User.LogOnName);
                foreach (var row in rows)
                {
                    string appName = row.Values.GetValue("ApplicationName", string.Empty);
                    if (!appList.Contains(appName))
                    {
                        appList.Add(appName);
                    }
                }
            }
            appList.Add(" ");
            return(appList.ToArray());
        }
コード例 #18
0
        /// <summary>
        /// 获取所有管理员用户信息
        /// </summary>
        /// <returns></returns>
        public static IEnumerable <IUser> GetAllUsers()
        {
            /*
             * RolesDefineConfig rolesConfig = RolesDefineConfig.GetConfig().;
             *
             * List<string> roleNames = new List<string>();
             *
             * foreach (RolesDefine roleDefine in rolesConfig.RolesDefineCollection)
             * {
             *      roleNames.Add(roleDefine.Name);
             * }
             *
             * IRole[] roles = rolesConfig.GetRolesInstances(roleNames.ToArray()); */

            IRole[] roles = RolesDefineConfig.GetConfig().RolesDefineCollection["ProcessAdmin"].GetRolesInstances();

            Dictionary <string, IUser> allUsers = new Dictionary <string, IUser>();

            foreach (IRole role in roles)
            {
                WfRoleResourceDescriptor       roleDescriptor  = new WfRoleResourceDescriptor(role);
                WfResourceDescriptorCollection roleDescriptors = new WfResourceDescriptorCollection(roleDescriptor);
                roleDescriptors.Add(roleDescriptor);

                OguDataCollection <IUser> roleUsers = roleDescriptors.ToUsers();

                foreach (IUser user in roleUsers)
                {
                    if (allUsers.ContainsKey(user.ID) == false)
                    {
                        allUsers.Add(user.ID, user);
                    }
                }
            }

            return(allUsers.Values);
        }
コード例 #19
0
        private static string GetCurrentUserAppAuthInfoScript()
        {
            string isAdmin     = "false";
            string appAuthInfo = "[]";

            if (DeluxePrincipal.IsAuthenticated)
            {
                if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles(DeluxeIdentity.CurrentUser, "ProcessAdmin"))
                {
                    isAdmin = "true";
                }

                WfApplicationAuthCollection authInfo = WfApplicationAuthAdapter.Instance.GetUserApplicationAuthInfo(DeluxeIdentity.CurrentUser);

                appAuthInfo = JSONSerializerExecute.Serialize(authInfo);
            }

            string script = ResourceHelper.LoadStringFromResource(Assembly.GetExecutingAssembly(), "MCS.Web.WebControls.Workflow.Abstract.currentUserPermissions.js");

            script = script.Replace("$_currentUserIsAdmin$", isAdmin);
            script = script.Replace("$_currentUserAppAuthInfoString$", appAuthInfo);

            return(script);
        }
コード例 #20
0
        /// <summary>
        /// 表单分页查询
        /// </summary>
        /// <param name="startRowIndex"></param>
        /// <param name="maximumRows"></param>
        /// <param name="where"></param>
        /// <param name="orderBy"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public AppCommonInfoCollection GetFormQueryWithCount(int startRowIndex, int maximumRows, string where, string orderBy, ref int totalCount)
        {
            if (string.IsNullOrEmpty(where))
            {
                where = "1 = 1";
            }

            if (string.IsNullOrEmpty(orderBy))
            {
                orderBy = "CREATE_TIME DESC";
            }

            if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin") == false)
            {
                ConnectiveSqlClauseCollection cscc = WfAclAdapter.Instance.GetAclQueryConditionsByUser(string.Empty);

                string resourceIDList = string.Format("SELECT RESOURCE_ID FROM WF.ACL WHERE {0}", cscc.ToSqlString(TSqlBuilder.Instance));

                where = string.Format("{0} AND ACI.RESOURCE_ID IN ({1})", where, resourceIDList);
            }

            //LDM 加上ACI.PROGRAM_NAME as [PROGRAM_NAME1],
            //兼容远洋地产的查询(表单工作程序里没有对 APPLICATIONFORM_INFO 表插入数据行)
            string strSelect = @" ACI.APPLICATION_NAME,ACI.[PROGRAM_NAME] as [PROGRAM_NAME_MCS],ACI.RESOURCE_ID,ACI.[SUBJECT],ACI.[EMERGENCY]," +
                               "  ACI.URL,ACI.CREATOR_ID, ACI.CREATOR_NAME,ACI.CREATE_TIME,ACI.DRAFT_DEPARTMENT_NAME";

            string strfrom = @" WF.APPLICATIONS_COMMON_INFO as ACI (nolock)";


            QueryCondition qc = new QueryCondition(
                startRowIndex,
                maximumRows,
                strSelect,
                strfrom,
                orderBy,
                where
                );
            CommonAdapter commonAdapter = new CommonAdapter(ConnectionDefine.SearchConnectionName);
            DataSet       ds            = commonAdapter.SplitPageQuery(qc, totalCount < 0);

            AppCommonInfoCollection FormQueryEntitys = new AppCommonInfoCollection();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                AppCommonInfo entity = new AppCommonInfo();

                ORMapping.DataRowToObject(row, entity);
                FormQueryEntitys.Add(entity);
            }

            if (ds.Tables.Count > 1)
            {
                totalCount = (int)ds.Tables[1].Rows[0][0];
            }

            HttpContext.Current.Items["UserFormQueryEntityCount"] = totalCount;

            //当页码超出索引的,返回最大页
            if (FormQueryEntitys.Count == 0 && totalCount > 0)
            {
                int newStartRowIndex = (totalCount - 1) / maximumRows * maximumRows;

                totalCount = -1;

                FormQueryEntitys = GetFormQueryWithCount(newStartRowIndex, maximumRows, where, orderBy, ref totalCount);
            }

            return(FormQueryEntitys);
        }
コード例 #21
0
        private static SOARolePropertyRowCollection PrepareReservedRows(SOARolePropertyDefinitionCollection pds)
        {
            SOARolePropertyRowCollection rows = new SOARolePropertyRowCollection();

            SOARolePropertyRow row1 = new SOARolePropertyRow()
            {
                RowNumber = 1, OperatorType = SOARoleOperatorType.User, Operator = "fanhy"
            };

            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "10"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver1"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "User"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = "fanhy"
            });


            SOARolePropertyRow row3 = new SOARolePropertyRow()
            {
                RowNumber = 3, OperatorType = SOARoleOperatorType.Role, Operator = RolesDefineConfig.GetConfig().RolesDefineCollection["nestedRole"].Roles
            };

            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "20"
            });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver2"
            });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "Role"
            });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = row3.Operator
            });

            SOARolePropertyRow row4 = new SOARolePropertyRow()
            {
                RowNumber = 4, OperatorType = SOARoleOperatorType.User, Operator = "quym"
            };

            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "20"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver2"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "User"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = "quym"
            });

            SOARolePropertyRow row5 = new SOARolePropertyRow()
            {
                RowNumber = 5, OperatorType = SOARoleOperatorType.User, Operator = "invalidUser"
            };

            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "30"
            });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver3"
            });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "User"
            });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = "invalidUser"
            });

            rows.Add(row1);
            rows.Add(row3);
            rows.Add(row4);
            rows.Add(row5);

            return(rows);
        }
コード例 #22
0
        private static SOARolePropertyRowCollection PrepareRows(SOARolePropertyDefinitionCollection pds)
        {
            SOARolePropertyRowCollection rows = new SOARolePropertyRowCollection();

            SOARolePropertyRow row1 = new SOARolePropertyRow()
            {
                RowNumber = 1, OperatorType = SOARoleOperatorType.User, Operator = "fanhy"
            };

            row1.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1001"
            });
            row1.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "1"
            });
            row1.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "30"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "10"
            });
            //row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ConditionColumn]) { Value = "RowOperators.Count > 0" });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver1"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityNameColumn])
            {
                Value = "一级审批"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "User"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = "fanhy"
            });

            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.EnterNotifyReceiverTypeColumn])
            {
                Value = "User"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.EnterNotifyReceiverColumn])
            {
                Value = "wangli5"
            });

            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.LeaveNotifyReceiverTypeColumn])
            {
                Value = "Role"
            });
            row1.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.LeaveNotifyReceiverColumn])
            {
                Value = RolesDefineConfig.GetConfig().RolesDefineCollection["notifyRole"].Roles
            });

            //SOARolePropertyRow row2 = new SOARolePropertyRow() { RowNumber = 2, OperatorType = SOARoleOperatorType.User, Operator = "wangli5" };

            //row2.Values.Add(new SOARolePropertyValue(pds["CostCenter"]) { Value = "1002" });
            //row2.Values.Add(new SOARolePropertyValue(pds["PayMethod"]) { Value = "2" });
            //row2.Values.Add(new SOARolePropertyValue(pds["Age"]) { Value = "40" });
            //row2.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ColumnActivitySN]) { Value = "10" });
            ////row2.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ConditionColumn]) { Value = "RowOperators.Count > 0" });
            //row2.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn]) { Value = "Approver1" });
            //row2.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ColumnOperatorType]) { Value = "User" });
            //row2.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn]) { Value = "wangli5" });

            SOARolePropertyRow row3 = new SOARolePropertyRow()
            {
                RowNumber = 3, OperatorType = SOARoleOperatorType.Role, Operator = RolesDefineConfig.GetConfig().RolesDefineCollection["nestedRole"].Roles
            };

            row3.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1002"
            });
            row3.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "2"
            });
            row3.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "60"
            });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "20"
            });
            //row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ConditionColumn]) { Value = "RowOperators.Count > 0" });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver2"
            });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityNameColumn])
            {
                Value = "二级审批"
            });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "Role"
            });
            row3.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = row3.Operator
            });

            SOARolePropertyRow row4 = new SOARolePropertyRow()
            {
                RowNumber = 4, OperatorType = SOARoleOperatorType.User, Operator = "quym"
            };

            row4.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1001"
            });
            row4.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "1"
            });
            row4.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "30"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "20"
            });
            //row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ConditionColumn]) { Value = "RowOperators.Count > 0" });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver2"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityNameColumn])
            {
                Value = "二级审批"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "User"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = "quym"
            });

            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.EnterNotifyReceiverTypeColumn])
            {
                Value = "Role"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.EnterNotifyReceiverColumn])
            {
                Value = RolesDefineConfig.GetConfig().RolesDefineCollection["notifyRole"].Roles
            });

            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.LeaveNotifyReceiverTypeColumn])
            {
                Value = "User"
            });
            row4.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.LeaveNotifyReceiverColumn])
            {
                Value = "wangli5"
            });

            SOARolePropertyRow row5 = new SOARolePropertyRow()
            {
                RowNumber = 5, OperatorType = SOARoleOperatorType.User, Operator = "invalidUser"
            };

            row5.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1001"
            });
            row5.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "1"
            });
            row5.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "30"
            });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivitySNColumn])
            {
                Value = "30"
            });
            //row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ConditionColumn]) { Value = "RowOperators.Count > 0" });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityCodeColumn])
            {
                Value = "Approver3"
            });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.ActivityNameColumn])
            {
                Value = "三级审批"
            });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorTypeColumn])
            {
                Value = "User"
            });
            row5.Values.Add(new SOARolePropertyValue(pds[SOARolePropertyDefinition.OperatorColumn])
            {
                Value = "invalidUser"
            });

            rows.Add(row1);
            //rows.Add(row2);
            rows.Add(row3);
            rows.Add(row4);
            rows.Add(row5);

            return(rows);
        }
コード例 #23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     ExceptionHelper.FalseThrow(DeluxePrincipal.Current.IsInRole(RolesDefineConfig.GetConfig().RolesDefineCollection["ProcessAdmin"].Roles), "你没有查看此页的权限");
 }
コード例 #24
0
        private static IRole GetTestRole()
        {
            IRole[] roles = DeluxePrincipal.GetRoles(RolesDefineConfig.GetConfig().RolesDefineCollection["testRole"].Roles);

            return(roles[0]);
        }
コード例 #25
0
        private static SOARole PrepareSOARole()
        {
            IRole originalRole = GetTestRole();

            SOARolePropertyDefinitionCollection pds = UpdateRolePropertiesDefinition(originalRole);

            SOARole role = new SOARole(originalRole.FullCodeName);

            role.Rows.Clear();

            SOARolePropertyRow row1 = new SOARolePropertyRow(role)
            {
                RowNumber = 1, OperatorType = SOARoleOperatorType.User, Operator = "fanhy,wanhw"
            };

            row1.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1001"
            });
            row1.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "1"
            });
            row1.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "30"
            });

            SOARolePropertyRow row2 = new SOARolePropertyRow(role)
            {
                RowNumber = 2, OperatorType = SOARoleOperatorType.User, Operator = "wangli5"
            };

            row2.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1002"
            });
            row2.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "2"
            });
            row2.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "40"
            });

            SOARolePropertyRow row3 = new SOARolePropertyRow(role)
            {
                RowNumber = 3, OperatorType = SOARoleOperatorType.Role, Operator = RolesDefineConfig.GetConfig().RolesDefineCollection["nestedRole"].Roles
            };

            row3.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1002"
            });
            row3.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "2"
            });
            row3.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "60"
            });

            role.Rows.Add(row1);
            role.Rows.Add(row2);
            role.Rows.Add(row3);

            SOARolePropertiesAdapter.Instance.Update(role);

            return(role);
        }
コード例 #26
0
        private static SOARolePropertyRowCollection PrepareRows(SOARolePropertyDefinitionCollection pds)
        {
            SOARolePropertyRowCollection rows = new SOARolePropertyRowCollection();

            SOARolePropertyRow row1 = new SOARolePropertyRow()
            {
                RowNumber = 1, OperatorType = SOARoleOperatorType.User, Operator = "fanhy"
            };

            row1.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1001"
            });
            row1.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "1"
            });
            row1.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "30"
            });

            SOARolePropertyRow row2 = new SOARolePropertyRow()
            {
                RowNumber = 2, OperatorType = SOARoleOperatorType.User, Operator = "wangli5"
            };

            row2.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1002"
            });
            row2.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "2"
            });
            row2.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "40"
            });

            SOARolePropertyRow row3 = new SOARolePropertyRow()
            {
                RowNumber = 3, OperatorType = SOARoleOperatorType.Role, Operator = RolesDefineConfig.GetConfig().RolesDefineCollection["nestedRole"].Roles
            };

            row3.Values.Add(new SOARolePropertyValue(pds["CostCenter"])
            {
                Value = "1002"
            });
            row3.Values.Add(new SOARolePropertyValue(pds["PayMethod"])
            {
                Value = "2"
            });
            row3.Values.Add(new SOARolePropertyValue(pds["Age"])
            {
                Value = "60"
            });

            rows.Add(row1);
            rows.Add(row2);
            rows.Add(row3);

            return(rows);
        }
コード例 #27
0
        public void CheckUserInAcl(IUser user, IWfProcess process, ref bool continueCheck)
        {
            user.NullCheck("user");

            continueCheck = (RolesDefineConfig.GetConfig().IsCurrentUserInRoles(user, "AdminFormQuery") == false);
        }
コード例 #28
0
ファイル: CategoryEdit.aspx.cs プロジェクト: wooln/AK47Source
        protected void OkClick(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                try
                {
                    if (RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin") == false)
                        throw new OperationDeniedException("只有管理员可以进行此操作");

                    RolesDefineConfig.GetConfig().IsCurrentUserInRoles("ProcessAdmin").FalseThrow("只有管理员可以进行此操作");

                    if (string.IsNullOrEmpty(this.ddPg.SelectedValue) == false)
                    {
                        var old = WfApplicationAuthAdapter.Instance.Load(this.ddApp.SelectedValue, this.ddPg.SelectedValue, this.chkAdjuster.Checked ? WfApplicationAuthType.FormAdmin : WfApplicationAuthType.FormViewer);
                        if (old == null)
                            old = new WfApplicationAuth() { ApplicationName = this.ddApp.SelectedValue, AuthType = this.chkAdjuster.Checked ? WfApplicationAuthType.FormAdmin : WfApplicationAuthType.FormViewer, ProgramName = this.ddPg.SelectedItem.Value };

                        old.RoleID = this.inputRole.Text;
                        old.RoleDescription = this.inputRoleName.Value;

                        WfApplicationAuthAdapter.Instance.Update(old);
                        WebUtility.CloseWindow();
                    }
                    else
                    {
                        var appName = this.ddApp.SelectedValue;
                        var authType = this.chkAdjuster.Checked ? WfApplicationAuthType.FormAdmin : WfApplicationAuthType.FormViewer;
                        var old = WfApplicationAuthAdapter.Instance.Load(appName, authType);
                        var appPrograms = WfApplicationAdapter.Instance.LoadProgramsByApplication(appName);

                        var roleID = this.inputRole.Text;
                        var roleDescription = this.inputRoleName.Value;

                        List<WfApplicationAuth> auths = new List<WfApplicationAuth>(appPrograms.Count);
                        foreach (var item in appPrograms)
                        {
                            WfApplicationAuth auth = old.Find(m => m.ApplicationName == appName && m.AuthType == authType && m.ProgramName == item.CodeName);
                            if (auth == null)
                            {
                                auths.Add(new WfApplicationAuth() { ApplicationName = appName, AuthType = authType, ProgramName = item.CodeName, RoleID = roleID, RoleDescription = roleDescription });
                            }
                            else if (auth.RoleID != roleID)
                            {
                                auth.RoleID = roleID;
                                auth.RoleDescription = roleDescription;
                                auths.Add(auth);
                            }
                        }

                        using (System.Transactions.TransactionScope scope = MCS.Library.Data.TransactionScopeFactory.Create())
                        {
                            foreach (var item in auths)
                            {
                                WfApplicationAuthAdapter.Instance.Update(item);
                            }

                            scope.Complete();
                        }

                        WebUtility.CloseWindow();
                    }
                }
                catch (Exception ex)
                {
                    WebUtility.ShowClientError(ex);
                }
            }
        }