Skip to Content
avatar image
Former Member

Permission

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 26, 2010 at 06:28 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 26, 2010 at 06:30 PM

    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

    Add comment
    10|10000 characters needed characters exceeded