Share this page

# Example: Controlling User Permissions

This example demonstrates how you can prevent members of specific user groups from performing an action.

The code allows a user to replace a defect field value only if the user belongs to the `Admin` user group.

Add the code to the ActionCanExecute event procedure so that the check is performed when a user attempts to execute an action.

    Function ActionCanExecute(ActionName)
            ' Initialize the function's return value
    	' to avoid unpredictable behavior.
            ActionCanExecute = False
            On Error Resume Next
            If ActionName = "UserDefinedActions.BugReplaceAction1" _
                And Not User.IsInGroup("Admin") then
                ActionCanExecute = False
                msgbox "You do not have permission to perform this action"
            Else
                ActionCanExecute = True
            End If
            PrintError "ActionCanExecute"
            On Error GoTo 0
    End Function

https://admhelp.microfocus.com ALM 8942
Tips to improve your search results... ALM Help Center ALM Help Center ALM Help 15.5-15.5.1 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: