diff --git a/conf/setup_user.py b/conf/setup_user.py index d838d3e..5378dd4 100644 --- a/conf/setup_user.py +++ b/conf/setup_user.py @@ -1,8 +1,14 @@ +from inventory.permissions import get_or_create_normal_user_group + + def setup_project_user(user): """ All users used the Django admin, so we need to set the "staff" user flag. Called from django_yunohost_integration.sso_auth """ + pyinventory_user_group = get_or_create_normal_user_group()[0] + user.groups.set([pyinventory_user_group]) + user.is_staff = True user.save() return user diff --git a/manifest.toml b/manifest.toml index 6b0aea0..14fa84c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ id = "pyinventory" name = "PyInventory" description.en = "Web based management to catalog things including state and location etc." -version = "0.19.3~ynh1" +version = "0.19.3~ynh2" maintainers = ["Jens Diemer"] diff --git a/pyinventory_ynh/__init__.py b/pyinventory_ynh/__init__.py index 3eca41e..95367b0 100644 --- a/pyinventory_ynh/__init__.py +++ b/pyinventory_ynh/__init__.py @@ -3,5 +3,5 @@ Web based management to catalog things including state and location etc. """ -__version__ = '0.19.3+ynh1' +__version__ = '0.19.3+ynh2' __author__ = 'Jens Diemer ' diff --git a/pyinventory_ynh/tests/test_django_project.py b/pyinventory_ynh/tests/test_django_project.py index 5adbf8a..8e7062d 100644 --- a/pyinventory_ynh/tests/test_django_project.py +++ b/pyinventory_ynh/tests/test_django_project.py @@ -87,6 +87,11 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase): parts=( f'

PyInventory v{upstream_version}

', 'test', + # + # Can create PyInventory model entries: + 'Add', + 'Add', + 'Add', ), ) assert_html_response_snapshot(response, query_selector='#main', validate=False) diff --git a/pyinventory_ynh/tests/test_django_project_create_unknown_user_1.snapshot.html b/pyinventory_ynh/tests/test_django_project_create_unknown_user_1.snapshot.html index e0f8bf9..211e57e 100644 --- a/pyinventory_ynh/tests/test_django_project_create_unknown_user_1.snapshot.html +++ b/pyinventory_ynh/tests/test_django_project_create_unknown_user_1.snapshot.html @@ -6,9 +6,66 @@ Site administration
-

- You don’t have permission to view or edit anything. -

+