コード例 #1
0
ファイル: PurchaseOrders.cs プロジェクト: lulzzz/allors2
        protected override void AppsSecure(Security config)
        {
            base.AppsSecure(config);

            var created          = new PurchaseOrderStates(this.Session).Provisional;
            var onHold           = new PurchaseOrderStates(this.Session).OnHold;
            var requestsApproval = new PurchaseOrderStates(this.Session).RequestsApproval;
            var inProcess        = new PurchaseOrderStates(this.Session).InProcess;
            var cancelled        = new PurchaseOrderStates(this.Session).Cancelled;
            var rejected         = new PurchaseOrderStates(this.Session).Rejected;
            var completed        = new PurchaseOrderStates(this.Session).Completed;
            var finished         = new PurchaseOrderStates(this.Session).Finished;

            var approve   = this.Meta.Approve;
            var reject    = this.Meta.Reject;
            var hold      = this.Meta.Hold;
            var @continue = this.Meta.Continue;
            var confirm   = this.Meta.Confirm;

            config.Deny(this.ObjectType, created, reject, approve, hold, @continue);
            config.Deny(this.ObjectType, requestsApproval, confirm, reject, approve, @continue);
            config.Deny(this.ObjectType, inProcess, confirm, reject, approve, @continue);
            config.Deny(this.ObjectType, onHold, confirm, reject, approve, hold);

            config.Deny(this.ObjectType, cancelled, Operations.Execute, Operations.Write);
            config.Deny(this.ObjectType, rejected, Operations.Execute, Operations.Write);
            config.Deny(this.ObjectType, completed, Operations.Execute, Operations.Write);
            config.Deny(this.ObjectType, finished, Operations.Execute, Operations.Write);
        }
コード例 #2
0
        protected override void BaseSecure(Security config)
        {
            var states    = new PurchaseOrderStates(this.Session);
            var created   = states.Created;
            var onHold    = states.OnHold;
            var cancelled = states.Cancelled;
            var rejected  = states.Rejected;
            var awaitingApprovalLevel1 = states.AwaitingApprovalLevel1;
            var awaitingApprovalLevel2 = states.AwaitingApprovalLevel2;
            var inProcess = states.InProcess;
            var sent      = states.Sent;
            var completed = states.Completed;
            var finished  = states.Finished;

            var approve               = this.Meta.Approve;
            var reject                = this.Meta.Reject;
            var hold                  = this.Meta.Hold;
            var @continue             = this.Meta.Continue;
            var setReadyForProcessing = this.Meta.SetReadyForProcessing;
            var cancel                = this.Meta.Cancel;
            var reopen                = this.Meta.Reopen;
            var send                  = this.Meta.Send;
            var revise                = this.Meta.Revise;
            var quickReceive          = this.Meta.QuickReceive;
            var invoice               = this.Meta.Invoice;

            config.Deny(this.ObjectType, created, approve, cancel, reject, @continue, reopen, send, quickReceive, invoice, revise);
            config.Deny(this.ObjectType, onHold, approve, hold, setReadyForProcessing, reopen, send, quickReceive, invoice, revise);
            config.Deny(this.ObjectType, cancelled, approve, reject, hold, @continue, setReadyForProcessing, cancel, send, quickReceive, invoice, revise);
            config.Deny(this.ObjectType, rejected, approve, reject, hold, @continue, setReadyForProcessing, cancel, send, quickReceive, invoice, revise);
            config.Deny(this.ObjectType, awaitingApprovalLevel1, hold, @continue, setReadyForProcessing, cancel, reopen, send, quickReceive, @continue, revise);
            config.Deny(this.ObjectType, awaitingApprovalLevel2, hold, @continue, setReadyForProcessing, cancel, reopen, send, quickReceive, @continue, revise);
            config.Deny(this.ObjectType, inProcess, approve, reject, @continue, setReadyForProcessing, quickReceive);
            config.Deny(this.ObjectType, inProcess, approve, reject, hold, @continue, setReadyForProcessing, reopen);
            config.Deny(this.ObjectType, sent, approve, reject, hold, @continue, setReadyForProcessing, reopen, send);
            config.Deny(this.ObjectType, completed, approve, reject, hold, @continue, setReadyForProcessing, cancel, reopen, send, quickReceive);

            var except = new HashSet <IOperandType>
            {
                this.Meta.ElectronicDocuments.RoleType,
                this.Meta.Print,
            };

            config.DenyExcept(this.ObjectType, inProcess, except, Operations.Write);
            config.DenyExcept(this.ObjectType, cancelled, except, Operations.Write);
            config.DenyExcept(this.ObjectType, rejected, except, Operations.Write, Operations.Execute);
            config.DenyExcept(this.ObjectType, completed, except, Operations.Write);
            config.DenyExcept(this.ObjectType, finished, except, Operations.Execute, Operations.Write);
        }