Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/lmn72' into lmn72
Browse files Browse the repository at this point in the history
  • Loading branch information
hermanntoast committed Oct 2, 2024
2 parents 9771404 + 514c7ad commit e25a2a8
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: mkdir package && cp ../linuxmuster-webui7_* ./package

- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: deb-package
path: package/*
Expand Down
11 changes: 11 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
linuxmuster-webui7 (7.2.60) lmn72; urgency=medium

* Update dependencies
* [auth] Fix root login at install
* [multischool] Fix adminclass in homepath
* [session] Avoid duplicates users
* [settings] Fix custom fields structure
* [settings] Reset custom display config

-- Arnaud Kientz <[email protected]> Wed, 25 Sep 2024 22:21:39 +0200

linuxmuster-webui7 (7.2.59) lmn72; urgency=medium

* [multischool] Add multischoolswitcher (@hermanntoast)
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Source: linuxmuster-webui7
Section: admin
Priority: optional
Maintainer: Andreas Till <[email protected]>
Maintainer: Arnaud Kientz <[email protected]>
Build-Depends: debhelper (>= 4.0.0), fakeroot

Package: linuxmuster-webui7
Architecture: all
Depends: python3-pip, python3-dev, python3-jinja2, python3-lxml, libffi-dev, libssl-dev, libjpeg-dev, libpng-dev, uuid-dev, libkrb5-dev, gcc, python3-dbus, python3-augeas, python3-apt, ntpdate, libldap2-dev, libsasl2-dev, python3-ldap, sophomorix-samba (>=3.90.0-2), nmap, linuxmuster-tools7
Depends: python3-pip, python3-dev, python3-jinja2, python3-lxml, libffi-dev, libssl-dev, libjpeg-dev, libpng-dev, uuid-dev, libkrb5-dev, gcc, python3-dbus, python3-augeas, python3-apt, ntpdate, libldap2-dev, libsasl2-dev, python3-ldap, sophomorix-samba (>=3.90.0-2), nmap, linuxmuster-tools7, libmagic1, python3-magic
Homepage: www.linuxmuster.net
Description: Next generation web-based management tool for linuxmuster.net v7.x
1 change: 1 addition & 0 deletions usr/lib/linuxmuster-webui/etc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ajenti.plugin.filesystem==0.50
ajenti.plugin.plugins==0.52
ajenti.plugin.settings==0.34
ajenti.plugin.session-list==0.7
configobj
configparser==3.5.0
cryptography>=41.0.0
dpath==2.0.6 # used for getSophomorixValue
Expand Down
64 changes: 36 additions & 28 deletions usr/lib/linuxmuster-webui/plugins/lmn_auth/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,39 +67,47 @@ def prepare_environment(self, username):
"""

# Initialize school manager
profil = self.get_ldap_user(username)
# Test purpose for multischool
if username in ["root", None] or profil['sophomorixSchoolname'] == 'global':
if username in ["root", None]:
active_school = "default-school"
else:
active_school = profil['sophomorixSchoolname']
profil = self.get_ldap_user(username)
# Test purpose for multischool
if profil['sophomorixSchoolname'] == 'global':
active_school = "default-school"
else:
active_school = profil['sophomorixSchoolname']

#active_school = self.get_profile(username)['activeSchool']
schoolmgr = SchoolManager()
schoolmgr.switch(active_school)
self.context.schoolmgr = schoolmgr
self.context.ldapreader = LMNLdapReader

def schoolget(*args, **kwargs):
"""
This alias allow to automatically pass the school context for school
specific requests.
"""

result = self.context.ldapreader.get(*args,**kwargs, school=self.context.schoolmgr.school)
return result

self.context.ldapreader.schoolget = schoolget

# Permissions for kerberos ticket
uid = self.get_isolation_uid(username)

if os.path.isfile(f'/tmp/krb5cc_{uid}{uid}'):
if os.path.isfile(f'/tmp/krb5cc_{uid}'):
os.unlink(f'/tmp/krb5cc_{uid}')
try:
schoolmgr = SchoolManager()
schoolmgr.switch(active_school)
self.context.schoolmgr = schoolmgr
self.context.ldapreader = LMNLdapReader

def schoolget(*args, **kwargs):
"""
This alias allow to automatically pass the school context for school
specific requests.
"""

result = self.context.ldapreader.get(*args,**kwargs, school=self.context.schoolmgr.school)
return result

self.context.ldapreader.schoolget = schoolget

os.rename(f'/tmp/krb5cc_{uid}{uid}', f'/tmp/krb5cc_{uid}')
logging.warning(f"Changing kerberos ticket rights for {username}")
os.chown(f'/tmp/krb5cc_{uid}', uid, 100)
# Permissions for kerberos ticket
uid = self.get_isolation_uid(username)

if os.path.isfile(f'/tmp/krb5cc_{uid}{uid}'):
if os.path.isfile(f'/tmp/krb5cc_{uid}'):
os.unlink(f'/tmp/krb5cc_{uid}')

os.rename(f'/tmp/krb5cc_{uid}{uid}', f'/tmp/krb5cc_{uid}')
logging.warning(f"Changing kerberos ticket rights for {username}")
os.chown(f'/tmp/krb5cc_{uid}', uid, 100)
except Exception as e:
logging.warning(str(e))

def _get_krb_ticket(self, username, password):
"""
Expand Down
39 changes: 24 additions & 15 deletions usr/lib/linuxmuster-webui/plugins/lmn_settings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,21 @@ def handle_api_read_custom_config(self, http_context, role=''):
:rtype: dict
"""

def ensure_config_structure(config, role=None):
base_display_dict = {
'teachers': {1: '', 2: '', 3:''},
'students': {1: '', 2: '', 3: ''},
}

def ensure_config_structure(config, number, role=None):
base_custom_dict = {'show': False, 'editable': False, 'title': ''}
base_role_dict = {
str(i+1):base_custom_dict
for i in range(3)
}
if number:
base_role_dict = {
str(i+1):base_custom_dict
for i in range(number)
}
else:
base_role_dict = base_custom_dict

base_config_dict = {
'globaladministrators': {},
'schooladministrators': {},
Expand All @@ -248,7 +257,7 @@ def ensure_config_structure(config, role=None):
role_dict = config.get(role, {})

if role_dict:
for i in range(3):
for i in range(number):
idx = str(i+1)
role_dict[idx] = role_dict.get(idx, base_custom_dict)
for key, value in base_custom_dict.items():
Expand All @@ -261,7 +270,7 @@ def ensure_config_structure(config, role=None):
role_dict = config.get(role, {})

if role_dict:
for i in range(3):
for i in range(number):
idx = str(i+1)
role_dict[idx] = role_dict.get(idx, base_custom_dict)
for key, value in base_custom_dict.items():
Expand All @@ -283,19 +292,19 @@ def ensure_config_structure(config, role=None):
password_templates['individual'] = password_templates.get('individual', '')

config_dict = {
'custom': ensure_config_structure(custom_config.get('custom', {})),
'customMulti': ensure_config_structure(custom_config.get('customMulti', {})),
'customDisplay': custom_config.get('customDisplay', {1:'', 2:'', 3:''}),
'proxyAddresses': ensure_config_structure(custom_config.get('proxyAddresses', {})),
'custom': ensure_config_structure(custom_config.get('custom', {}), 5),
'customMulti': ensure_config_structure(custom_config.get('customMulti', {}), 5),
'customDisplay': custom_config.get('customDisplay', base_display_dict),
'proxyAddresses': ensure_config_structure(custom_config.get('proxyAddresses', {}), 0),
'passwordTemplates': password_templates,
}

if role:
role_dict = {
'custom': ensure_config_structure(config_dict['custom'], role),
'customMulti': ensure_config_structure(config_dict['customMulti'], role),
'customDisplay': config_dict['customDisplay'].get(role, {1:'', 2:'', 3:''}),
'proxyAddresses': ensure_config_structure(config_dict['proxyAddresses'], role),
'custom': ensure_config_structure(config_dict['custom'], 5, role),
'customMulti': ensure_config_structure(config_dict['customMulti'], 5, role),
'customDisplay': config_dict['customDisplay'].get(role, {1: '', 2: '', 3:''}),
'proxyAddresses': ensure_config_structure(config_dict['proxyAddresses'], 0, role),
}
return role_dict
return config_dict
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
angular.module('lmn.common').service('customFields', function($http, messagebox, gettext, notify) {

this.customDisplayOptions = [
'',
'proxyAddresses',
'sophomorixCustom1',
'sophomorixCustom2',
Expand Down

0 comments on commit e25a2a8

Please sign in to comment.