introlab / opentera

OpenTera - Open TeleRehabilitation Server and Micro-Services
https://github.com/introlab/opentera
Apache License 2.0
17 stars 9 forks source link

Create two different role decorator #227

Closed carolanegt closed 1 year ago

carolanegt commented 1 year ago

Create two different role decorator It would be useful to have two different role decorator. In the file opentera/teraserver/python/opentera/services/ServiceAccessManager.py , a decorator is present to verify if a user as the appropriate role to access a ressource. For now, the user need to have all the role precised in the decorator to have access to the ressource (line 427). In my case, it would be really usefull to have the key word any. In fact, I want to have the ability to access a function according to the specific role of the person and assigned a single role per user. However, with the current function, it's complicated because if I want to give two people with different roles access to a function and subsequently give access to separate functions for each role, it's impossible. I have to give the two roles to the two individuals to have access to the first function, and therefore, the 2 users can have access to the function which would be reserved for only one of the roles.

Describe alternatives you've considered Changing in library the word all for any and use this modified decorator instead.

UserRoleAlternative.txt