cancel
Showing results for 
Search instead for 
Did you mean: 

Check User Permission ( UserPermission )

robert_lamb2
Explorer
0 Kudos

I have a user defined object which has a UserPermission. I have Full/ReadOnly/None authorisation for its associated form. This works fine but the is also a higher level function that updates all records in the table by importing data from an external source. I have created a child authorisation and made it an Item. How do check whether the current user has this authoristion in my Add-On?

Accepted Solutions (0)

Answers (2)

Answers (2)

robert_lamb2
Explorer
0 Kudos

I did not require to change the Permission just get the value.

The following code shows how I got the value:

Dim oCompany as SAPbobsCOM.Company

Dim oSBObob As SAPbobsCOM.SBObob

Dim oPermission As SAPbobsCOM.Recordset

Dim PermissionValue as Integer

oSBObob = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)

oPermission = Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

oPermission = oSBObob.GetSystemPermission(oCompany.UserName, "PermissionID")

PermissionValue = oPermission.Fields.Item(0).Value

'The PermissionValue variable can then be checked against the BoPermission Enumeration

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Robert,

Have you tried to use the UserPermission property in the Users object (DI API)?

 oUser.UserPermission.PermissionID = txtPermissionID.Text
 oUser.UserPermission.Permission = SAPbobsCOM.BoPermission.boper_Full
 
 retVal = oUser.Update()

Hope it helps

Trinidad.