root 2021-05-30 17:44:35 +02:00
parent 7c7736c834
commit 03d926dbe4
6 changed files with 22 additions and 5 deletions

View File

@ -63,6 +63,10 @@ def send_templates(path):
def send_static_js(path):
return send_from_directory(os.path.join(app.root_path, 'static'), path)
@app.route('/isard-sso-admin/avatars/<path:path>')
def send_avatars_img(path):
return send_from_directory(os.path.join(app.root_path, '../avatars/master-avatars'), path)
# @app.errorhandler(404)
# def not_found_error(error):
# return render_template('page_404.html'), 404

View File

@ -147,7 +147,7 @@ class Admin():
return True
def get_moodle_users(self):
return self.moodle.get_users_with_groups_and_roles()
return [u for u in self.moodle.get_users_with_groups_and_roles() if u['username'] not in ['guest','ddadmin','admin'] and not u['username'].startswith('system')]
## TOO SLOW. Not used.
# def get_moodle_users(self):
@ -173,7 +173,7 @@ class Admin():
"email": u.get('email',''),
"groups": u['group'],
"roles": filter_roles_list(u['role'])}
for u in users]
for u in users if u['username'] not in ['guest','ddadmin','admin'] and not u['username'].startswith('system')]
def get_nextcloud_users(self):
return [{"id":u['username'],
@ -183,7 +183,7 @@ class Admin():
"email": u.get('email',''),
"groups": u['groups'],
"roles": False}
for u in self.nextcloud.get_users_list()]
for u in self.nextcloud.get_users_list() if u['username'] not in ['guest','ddadmin','admin'] and not u['username'].startswith('system')]
## TOO SLOW
# def get_nextcloud_users(self):

View File

@ -183,6 +183,11 @@ $(document).ready(function() {
],
"order": [[4, 'asc']],
"columnDefs": [ {
"targets": 1,
"render": function ( data, type, full, meta ) {
return '<img src="/isard-sso-admin/avatars/'+full.id+'" alt="X" title="'+full.id+'" width="25" height="25">'
}},
{
"targets": 2,
"render": function ( data, type, full, meta ) {
if(full.keycloak){

View File

@ -34,7 +34,7 @@
<thead>
<tr>
<th></th>
<th>Id</th>
<th>Avatar</th>
<th>Keycloak</th>
<th>K.Groups</th>
<th>K.Roles</th>

View File

@ -131,7 +131,7 @@ class MoodleSaml():
def set_moodle_saml_plugin(self):
config={'idpmetadata': self.parse_idp_metadata(),
'certs_locked': '1',
'duallogin': '0',
'duallogin': '1',
'idpattr': 'username',
'autocreate': '1',
'saml_role_siteadmin_map': 'admin',

View File

@ -63,3 +63,11 @@ class Menu():
return self.menudict
# with open('menu.yaml', 'w') as yml:
# print(yaml.dump(header, yml, allow_unicode=True))
def parse_css_color(self):
pass
#Replace colors in dd.css based on system.yml:
# colours:
# background: "#F0F0F0"
# primary: "#92AE01"
# secondary: "#FFFFFF"