I was trying to implement an authority-check in my DPC_EXT class of an OData service for the entity todos
in the get_entity
method:
METHOD todosset_get_entity.
AUTHORITY-CHECK OBJECT 'S_TABU_NAM'
ID 'ACTVT' FIELD '03'
ID 'TABLE' FIELD 'ZALM_FS_TODOS'.
IF sy-subrc <> 0.
MESSAGE |No Authorization access! | TYPE 'E'.
* Implement a suitable exception handling here
ENDIF.
In the first try, it did not work, which was expected. Then I added the rights for my user in PFCG
:
I then generated the profile and added my user, and it worked as expected.
BUT:
I then removed my user from the role completely... (and also inactivated and regenerated the profile), but it still did work to retrieve single todos
in my gateway service.
I don't understand why, do I have to regenerate the classes in SEGW
? Clear caches or something?
Did I overlook something?
And by the way, it made no difference if the TABLE
authorization field value was changed to ZALM_FS_TODOS
or ZALM_FS_USERS
, but I don't get it why, it did not work in the first place... and after adding my user to the generated correct security profile it did work... so it should be the other way around and not work anymore when I revert my security roles again!?