‎2005 Nov 03 3:12 PM
Hi,
I would need to run an AUTHORITY-CHECK on a certain authority object, but I have to run the AUTHORITY-CHECK not for the currently logged in user, but for a different sap userId. How can I do this?
AUTHORITY-CHECK does not allow you to supply a userId as parameter. Changing sy-uname is probably not possible, and even if it was, this solution would just be too stupid and ugly for me to even try. There must be some simpler/better solution?
The Business Case for this is very simple: In my dialog program the currently logged in user is presented with a form to enter a SAP-userId, and attach a document. The user should only be allowed to post this form, if the supplied userId is authorized to receive this kind of document.
Thanks for any help in advance,
-Hans
‎2005 Nov 03 4:18 PM
Hans,
You can use the function module 'authority_check' to check whether a specific user has authorization for the required authorization object.
Thanks
Giridhar
‎2005 Nov 03 3:40 PM
Hi Hans,
I think there are little chances to switch the user context. The only solution I see, is based on batch jobs, which you could run under a different user. But this contradicts a dialog application.
Best regards
Rabanus
‎2005 Nov 03 3:42 PM
Hi Hans,
You can do the posting part in RFC. In the RFC you can pass the user id and checks and all will be executed for that user with which RFC is being accessed.
Thanks,
Anuranjan
‎2005 Nov 03 3:54 PM
Hi Hans!
Sounds like an own authority-check (is there a standard transaction where you can enter the user-id?). Why don't you just add user-id as a field in the authority object?
The test would be, if your user is allowed to send to this user-id, so maintenance might be a little strange.
If it's really own development, then your check is not necessarily going for authority: you might test for a 'customizing' entry in an own table.
Regards,
Christian
‎2005 Nov 03 3:56 PM
Hi Hans,
have a look to this function : SUSR_USER_AUTH_FOR_OBJ_GET
Regards
Frédéric
‎2005 Nov 03 3:57 PM
‎2005 Nov 03 4:18 PM
Hans,
You can use the function module 'authority_check' to check whether a specific user has authorization for the required authorization object.
Thanks
Giridhar
‎2005 Nov 07 10:07 AM
Hi,
Thanks a lot for all your replies. The FM authority_check seems to be the way to go
-Hans