示例#1
0
        private static void CheckStartProcessUserPermission(IWfProcess process)
        {
            if (process.EntryInfo == null &&
                WfRuntime.ProcessContext.EnableSimulation == false)
            {
                //看看是否使用起始点的指派人是否限为流程启动人
                if (process.Descriptor.Properties.GetValue("OnlyInitialResourcesCanStartProcess", false))
                {
                    bool allowed = DeluxePrincipal.IsAuthenticated;

                    if (allowed)
                    {
                        allowed = process.InitialActivity.Candidates.Contains(DeluxeIdentity.CurrentUser);
                    }

                    allowed.FalseThrow(Translator.Translate(Define.DefaultCulture, "只有流程起始活动的指派人才能启动流程"));
                }
                else
                {
                    if (process.Descriptor.ProcessStarters.Count > 0)
                    {
                        OguDataCollection <IUser> starters = process.Descriptor.ProcessStarters.ToUsers();

                        (starters.FindSingleObjectByID(DeluxeIdentity.CurrentUser.ID) != null).FalseThrow(
                            Translator.Translate(Define.DefaultCulture, "只有被允许启动流程的人才能启动流程"));
                    }
                }
            }
        }