好日子
如何在Acumatica中限制用户只能访问某些销售订单类型?
谢谢您
这是比较老的代码,但您可以尝试根据角色进行限制。在这个例子中,Guest Role用户被限制为IN和TR订单类型。
[PXDBString(2, IsKey = true, IsFixed = true, InputMask = ">aa")]
[PXDefault(SOOrderTypeConstants.SalesOrder, typeof(SOSetup.defaultOrderType))]
[PXSelector(typeof(Search5<SOOrderType.orderType,
InnerJoin<SOOrderTypeOperation, On<SOOrderTypeOperation.orderType,
Equal<SOOrderType.orderType>, And<SOOrderTypeOperation.operation, Equal<SOOrderType.defaultOperation>>>,
LeftJoin<SOSetupApproval, On<SOOrderType.orderType, Equal<SOSetupApproval.orderType>>
, InnerJoin<Users, On<Current<AccessInfo.userName>, Equal<Users.username>>
, InnerJoin<UsersInRoles, On<Users.username, Equal<UsersInRoles.username>>
, InnerJoin<Roles, On<Roles.rolename, Equal<UsersInRoles.rolename>>>>>>>,
Where2<Where<Roles.guest, Equal<False>>,
Or<Where<SOOrderType.orderType, Equal<string_IN>,
Or<SOOrderType.orderType, Equal<string_TR>>>>>,
Aggregate<GroupBy<SOOrderType.orderType>>>))]
[PXRestrictor(typeof(Where<SOOrderTypeOperation.iNDocType, NotEqual<INTranType.transfer>,
Or<FeatureInstalled<FeaturesSet.warehouse>>>), ErrorMessages.ElementDoesntExist, typeof(SOOrderType.orderType))]
[PXRestrictor(typeof(Where<SOOrderType.requireAllocation, NotEqual<True>,
Or<AllocationAllowed>>), ErrorMessages.ElementDoesntExist, typeof(SOOrderType.orderType))]
[PXRestrictor(typeof(Where<SOOrderType.active, Equal<True>>), null)]
[PXUIField(DisplayName = "Order Type", Visibility = PXUIVisibility.SelectorVisible)]
[PX.Data.EP.PXFieldDescription]
protected virtual void SOOrder_OrderType_CacheAttached(PXCache sender) { }