on 01-02-2007 4:05 PM
Hello,
i've developed an addon that creates a menu with many sub-menus.
I'd like to give the oppurtunity to 'superusers' to manage authorizations for my addon features, just like the User authorization Form of SAP B1.
Is there a way to do it in automatic or semi-automatic?
Or should i build it on my own?
Thank
Paolo
Hi Paolo,
You have a sample provided with the SDK about Permissions, just have a look at it.
With SDK you can create new permissions and even assign them to the different users. The permissions you create with the DI API are also visible in B1 if you open the Authorizations form, under User Autorizations.
Hope it helps
Trinidad.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Trinidad,
i tried to do it with SAP B1 but i didn't understand what to put in the Module ID grid. I tried putting the form_type as seen in the sdk sample and it worked.
Now, i've got some questions:
1. Can i use only form_type as Module ID?
2. How does the IsItem flag works? I tried flagging it and use an Item ID as Module ID but it didn't work.
Can you explain something more?
Thanks
Paolo
Hi Paolo,
Supose you have a Menu like this:
Apparel
->Setup
-
>Parameters
-
>Error Log
->Other Menu
Here, the Parameters menu and Error Log opens a form, on which you can create SAP Authorizations.
So, here goes the code for creating the schema:
Supose the FormType are FORM_PARAMETERS and FORM_ERRORLOG.
Private Sub Test()
Dim li_RetVal As Integer
Dim pUserPer As SAPbobsCOM.UserPermissionTree
Try
pUserPer = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserPermissionTree)
'Apparel One
If pUserPer.GetByKey("AppOne") = False Then
pUserPer.PermissionID = "AppOne"
pUserPer.Name = "Apollo Apparel One"
pUserPer.Options = SAPbobsCOM.BoUPTOptions.bou_FullNone
li_RetVal = pUserPer.Add()
End If
'Apparel One -> Setup
If pUserPer.GetByKey("AppOneSetup") = False Then
pUserPer.PermissionID = "AppOneSetup"
pUserPer.Name = "Setup"
pUserPer.Options = SAPbobsCOM.BoUPTOptions.bou_FullNone
pUserPer.ParentID = "AppOne"
li_RetVal = pUserPer.Add()
End If
'Apparel One -> Setup -> Parameters
If pUserPer.GetByKey("AppOneParam") = False Then
pUserPer.PermissionID = "AppOneParam"
pUserPer.Name = "Parameters"
pUserPer.Options = SAPbobsCOM.BoUPTOptions.bou_FullNone
pUserPer.ParentID = "AppOneSetup"
pUserPer.UserPermissionForms.FormType = "FORM_PARAMETERS"
li_RetVal = pUserPer.Add()
End If
'Apparel One -> Setup -> Error Log
If pUserPer.GetByKey("AppOneLog") = False Then
pUserPer.PermissionID = "AppOneLog"
pUserPer.Name = "Error Log"
pUserPer.Options = SAPbobsCOM.BoUPTOptions.bou_FullNone
pUserPer.ParentID = "AppOneSetup"
pUserPer.UserPermissionForms.FormType = "FORM_ERRORLOG"
li_RetVal = pUserPer.Add()
End If
Catch ex As Exception
MsgBox("Error")
End Try
End Sub
Hope it helps.
Emanuel.
Hi Diego,
Check this from
Dim oUsr As SAPbobsCOM.Users
oUsr = oCompany.GetBusinessObject(BoObjectTypes.oUsers)
oUsr.GetByKey(UserID)
For i As Integer = 0 To oUsr.UserPermission.Count - 1
oUsr.UserPermission.SetCurrentLine(i)
'Check the permission code
System.Diagnostic.Debug.WriteLine(oUsr.UserPermission.PermissionID)
'Check the permission given
System.Diagnostic.Debug.WriteLine(oUsr.UserPermission.Permission)
Next
Regards
Edy
Hi Diego,
The permission creation is already answered by Emmanuel.
Menu creation in SBO ? or the menu in the Additional Authorization screen ?
If it is the later, when you create the permission, it is already created automatically.
Menu in SBO, use the SBO_Application.Menus property.
Best Regards
Edy
HI, great example but how you validate if the user have permissions because if I not have permissions the option in the menu is not visible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
See the UserPermissionTree Object in the DI. = Administration > System Initialization > Authorisations > Additional Authorisation Creator
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
11 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.