on 06-26-2010 7:22 PM
Hi EveryBody
We have an add-on, and we would like to restrict the access or to hide menu of this add-on to specific user.
How we can do it ?
Thank you,
Regards
Jaggy
Hi
You may do it a bit professional, create user permisson as
oPermission = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserPermissionTree)
oPermission.Name = "Permission for form 1"
oPermission.PermissionID = "form1"
oPermission.UserPermissionForms.FormType = "f1"
oPermission.ParentID = "take here parrent id"
oPermission.Options = SAPbobsCOM.BoUPTOptions.bou_FullNone
RetVal = oPermission.Add()
oPermission = Nothing
GC.Collect()
after that in time when you are creating menus, you may cehck if user has this permission and if not, dont create menu
if hasright("form1") then
'create menu
end if
and hasright is as
Function hasright(ByVal permid As String) As Boolean
Dim result As Boolean = False
Dim orecset As SAPbobsCOM.Recordset
orecset = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
orecset.DoQuery("select superuser from ousr with(nolock) where superuser = N'Y' and userid = " & oCompany.UserSignature)
If orecset.RecordCount > 0 Then
result = True
End If
'isnt super user, i must test user rights
If result = False Then
orecset.DoQuery("select userlink from usr3 with(nolock) where PermId = N'" & permid & "' and (permission = 'F' ) and userlink = " & oCompany.UserSignature)
If orecset.RecordCount > 0 Then
result = True
End If
End If
orecset = Nothing
GC.Collect()
Return result
End Function
Now you can set user permissions in permission tree in sbo form and will be not hardcoded.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jaggy,
You may restrict such users in the license for add-on. Just do not assign license for add-on to them.
Thanks,
Gordon
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.