abapGit/docs/ref-authorizations.md
Eduardo Ferrari Copat 273f0682bc Docs: Authorizations (#2186)
* Insert initial line before bothsequence and action

* Package names validations

validate if package has more than 30 characters name and if root packages does not contain a package with the same name as his.

* Docs: authorizations

* typo + grammar

* newline at EOF
2018-12-06 08:12:58 +01:00

1.4 KiB

title category order
Authorizations reference 50

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 ¹ .

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.