Skip to content

Commit

Permalink
Allow admins to print teachers passwords, right parameter in lmn_chec…
Browse files Browse the repository at this point in the history
…kPermission.

Please test it before packaging: on my own server, teachers cannot see other teachers passwords.
  • Loading branch information
kiarn committed Jun 29, 2019
1 parent 8832932 commit e262752
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions usr/lib/linuxmuster-webui/plugins/lmn_common/api.py
Expand Up @@ -201,10 +201,10 @@ def lmn_getSophomorixValue(sophomorixCommand, jsonpath, ignoreErrors=False):

# check if the current user has a specific permissions
def lmn_checkPermission(permission):
## Permission needs to be a dict like {'id': 'lm:users:teachers:read', 'default': False}
username = aj.worker.context.identity
try:
AuthenticationService.get(aj.worker.context).get_provider().authorize(username, permission)
return True
return AuthenticationService.get(aj.worker.context).get_provider().authorize(username, permission)
except:
return False

Expand Down
2 changes: 1 addition & 1 deletion usr/lib/linuxmuster-webui/plugins/lmn_users/views.py
Expand Up @@ -542,7 +542,7 @@ def handle_api_users_print(self, http_context):
classes = []
else:
classes = classes_raw['LIST_BY_sophomorixSchoolname_sophomorixAdminClass'][school]
if lmn_checkPermission('lm:users:teachers:read'):
if lmn_checkPermission({'id': 'lm:users:teachers:read', 'default': False}):
# append empty element. This references to all users
classes.append('')
else:
Expand Down

1 comment on commit e262752

@PLanB2008
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I double checked your changes. This seems to work fine. Thanks for fixing this issue.

Please sign in to comment.