biuan SAP® BUSINESS ONE SDK
DTW Administration / System Initialization / Authorization / User Permission Tree
API User Permission Tree

Description

UserPermissionTree is a business object that represents the User Authorization Form. This object enables to manage user authorization for new forms (which their FormType property is defined in UserPermissionForms object).

After adding a user permission tree to the Authorizations tree, you can set the UserPermission object.

This object enables you to:

  • Add a user permission tree to the Authorizations tree.
  • Retrieve a user permission tree by its key.
  • Update a user permission tree.
  • Remove a user permission tree from the Authorizations tree.
  • Save the object in XML format.

Source table: OUPT.

Object Model

Remarks

Mandatory field in SAP Business One: PermissionId.

To display the form in the application:

  • Select Administration --> System Initialization --> Authorization --> User Authorization Form.

See example of User Authorization Form.

To manage user authorization for forms that are not forms, set the mUserPermission.IsItem = tYES and create the logic to support the item permission.

Example

Adding a PermissionTree - parent object (Visual Basic)
Name=Code_VB>
[Visual Basic] Dim RetVal As Long Dim ErrCode As Long Dim ErrMsg As String Dim mUserPermission As SAPbobsCOM.UserPermissionTree Set mUserPermission = oCompany.GetBusinessObject(oUserPermissionTree) '//Mandatory field, which is the key of the object. '//The partner namespace must be included as a prefix followed by _ mUserPermission.PermissionId = "SM_MathClass" '//The Name value that will be displayed in the General Authorization Tree mUserPermission.Name = "SM_MathClass" '//The permission that this object can get mUserPermission.Options = bou_FullReadNone '//In case the level is one, there Is no need to set the FatherID parameter. mUserPermission.Levels = 1 RetVal = UserPermission.Add oCompany.GetLastError RetVal, ErrMsg '//In case this permission object has a son permission object
Adding a PermissionTree - child object (Visual Basic)
Name=Code_VB>
[Visual Basic] Dim RetVal As Long Dim ErrCode As Long Dim ErrMsg As String Dim mUserPermission As SAPbobsCOM.UserPermissionTree Set mUserPermission = oCompany.GetBusinessObject(oUserPermissionTree) mUserPermission.PermissionId = "SM_MathClassSon" mUserPermission.Name = "SM_MathClassExam" mUserPermission.Options = bou_FullNone '//For level 2 and up you must set the object's father unique ID mUserPermission.Levels = 2 mUserPermission.FatherID = "SM_MathClass" '//this object manages forms mUserPermission.UserPermissionForm.FormType = "GL_MathClass" RetVal = mUserPermission.Add oCompany.GetLastError RetVal, ErrMsg [Visual Basic] Dim RetVal As Long Dim ErrCode As Long Dim ErrMsg As String Dim mUser As SAPbobsCOM.Users Set mUser = oCompany.GetBusinessObject(oUsers) '//The user unique ID is 2 RetVal = mUser.GetByKey(2) '//Setting a new sub object for the User that hold the user permission for the user permission object mUser.UserPermission.PermissionId = "SM_MathClassSon" '//Seting full permission for User 2 to manage SM_MathClassSon sub object mUsers.UserPermission.Permission = boper_Full RetVal = mUsers.Update oCompany.GetLastError RetVal, ErrMsg
Setting user permission (Visual Basic)
Name=Code_VB>
Dim RetVal As Long Dim ErrCode As Long Dim ErrMsg As String Dim mUser As SAPbobsCOM.Users Set mUser = oCompany.GetBusinessObject(oUsers) '//The user unique ID is 2 RetVal = mUser.GetByKey(2) '//Setting a new sub object for the User that hold the user permission for the user permission object mUser.UserPermission.PermissionId = "SM_MathClassSon" '//Seting full permission for User 2 to manage SM_MathClassSon sub object mUsers.UserPermission.Permission = boper_Full RetVal = mUsers.Update oCompany.GetLastError RetVal, ErrMsg

See Also

SAP® B1 DI-API C# definition

public class UserPermissionTreeClass : IUserPermissionTree, UserPermissionTree { public virtual DataBrowser Browser { get; } public virtual int DisplayOrder { get; } public virtual BoYesNoEnum IsItem { get; set; } public virtual int Levels { get; } public virtual string Name { get; set; } public virtual BoUPTOptions Options { get; set; } public virtual string ParentID { get; set; } public virtual string PermissionID { get; set; } public virtual SAPbobsCOM.UserFields UserFields { get; } public virtual SAPbobsCOM.UserPermissionForms UserPermissionForms { get; } public virtual int UserSignature { get; set; } public extern UserPermissionTreeClass(); public virtual extern int Add(); public virtual extern string GetAsXML(); public virtual extern bool GetByKey( string PermissionID); public virtual extern int Remove(); public virtual extern void SaveToFile( string FileName); public virtual extern void SaveXML( ref string FileName); public virtual extern int Update(); }

Related information


User Permission Forms UserPermissionForms Object· Table: UPT1
UserPermissionForms is a child object of UserPermissionTree object and enables to add a user permission to a collection of forms. Source table: UPT1.
   Parent: User Permission Tree UserPermissionTree Object· Table: OUPT

Bo UPT Options BoUPTOptions Enumeration
Specifies the permission options available for users.
   Parent: User Permission Tree UserPermissionTree Object· Table: OUPT


SAP® Business One is the trademark(s) or registered trademark(s) of SAP AG in Germany and in several other countries. Contact
This website is not affiliated with, maintained, authorized, endorsed or sponsored by SAP AG or any of its affiliates