Skip to main content

Authorizations

abapGitLess than 1 minutereference

You can block actions from users using Authorizations.

You need to create a class named ZCL_ABAPGIT_AUTH_EXIT implementing interface ZIF_ABAPGIT_AUTH, and put inside include ZABAPGIT_AUTHORIZATIONS_EXIT ¹open in new window .

Note: If you are using the abapGit development version, do not create the class in the abapGit package.

The interface ZIF_ABAPGIT_AUTH has a constant with all the possible authorizations. Such as:

  • uninstall
  • transport_to_branch
  • update_local_checksum

Example

Suppose you want to limit the uninstalling of packages to a user named Admin. Your code could look like:

*&---------------------------------------------------------------------*
*&  Include  zabapgit_authorizations_exit
*&---------------------------------------------------------------------*
CLASS zcl_abapgit_auth_exit DEFINITION
 CREATE PUBLIC.

  PUBLIC SECTION.
    INTERFACES zif_abapgit_auth.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS zcl_abapgit_auth_exit IMPLEMENTATION.
  METHOD zif_abapgit_auth~is_allowed.
    IF iv_authorization = zif_abapgit_auth~gc_authorization-uninstall.
      IF sy-uname = 'ADMIN'.
        rv_allowed = abap_true.
      ELSE.
        rv_allowed = abap_false.
      ENDIF.
    ENDIF.
  ENDMETHOD.
ENDCLASS.