mirror of
https://github.com/YunoHost-Apps/pyinventory_ynh.git
synced 2024-09-03 20:16:09 +02:00
Bugfix user creation: Add new user into correct user group
This commit is contained in:
parent
1e2fc68bd3
commit
a6860459fb
5 changed files with 73 additions and 5 deletions
|
@ -1,8 +1,14 @@
|
||||||
|
from inventory.permissions import get_or_create_normal_user_group
|
||||||
|
|
||||||
|
|
||||||
def setup_project_user(user):
|
def setup_project_user(user):
|
||||||
"""
|
"""
|
||||||
All users used the Django admin, so we need to set the "staff" user flag.
|
All users used the Django admin, so we need to set the "staff" user flag.
|
||||||
Called from django_yunohost_integration.sso_auth
|
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.is_staff = True
|
||||||
user.save()
|
user.save()
|
||||||
return user
|
return user
|
||||||
|
|
|
@ -5,7 +5,7 @@ id = "pyinventory"
|
||||||
name = "PyInventory"
|
name = "PyInventory"
|
||||||
description.en = "Web based management to catalog things including state and location etc."
|
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"]
|
maintainers = ["Jens Diemer"]
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
Web based management to catalog things including state and location etc.
|
Web based management to catalog things including state and location etc.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = '0.19.3+ynh1'
|
__version__ = '0.19.3+ynh2'
|
||||||
__author__ = 'Jens Diemer <pyinventory_ynh@jensdiemer.de>'
|
__author__ = 'Jens Diemer <pyinventory_ynh@jensdiemer.de>'
|
||||||
|
|
|
@ -87,6 +87,11 @@ class DjangoYnhTestCase(HtmlAssertionMixin, TestCase):
|
||||||
parts=(
|
parts=(
|
||||||
f'<h1 id="site-name"><a href="/app_path/">PyInventory v{upstream_version}</a></h1>',
|
f'<h1 id="site-name"><a href="/app_path/">PyInventory v{upstream_version}</a></h1>',
|
||||||
'<strong>test</strong>',
|
'<strong>test</strong>',
|
||||||
|
#
|
||||||
|
# Can create PyInventory model entries:
|
||||||
|
'<a class="addlink" href="/app_path/inventory/itemmodel/add/">Add</a>',
|
||||||
|
'<a class="addlink" href="/app_path/inventory/locationmodel/add/">Add</a>',
|
||||||
|
'<a class="addlink" href="/app_path/inventory/memomodel/add/">Add</a>',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
assert_html_response_snapshot(response, query_selector='#main', validate=False)
|
assert_html_response_snapshot(response, query_selector='#main', validate=False)
|
||||||
|
|
|
@ -6,9 +6,66 @@
|
||||||
Site administration
|
Site administration
|
||||||
</h1>
|
</h1>
|
||||||
<div id="content-main">
|
<div id="content-main">
|
||||||
<p>
|
<div class="app-inventory module">
|
||||||
You don’t have permission to view or edit anything.
|
<table>
|
||||||
</p>
|
<caption>
|
||||||
|
<a class="section" href="/app_path/inventory/" title="Models in the Inventory application">
|
||||||
|
Inventory
|
||||||
|
</a>
|
||||||
|
</caption>
|
||||||
|
<tr class="model-itemmodel">
|
||||||
|
<th scope="row">
|
||||||
|
<a href="/app_path/inventory/itemmodel/">
|
||||||
|
Items
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<a class="addlink" href="/app_path/inventory/itemmodel/add/">
|
||||||
|
Add
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="changelink" href="/app_path/inventory/itemmodel/">
|
||||||
|
Change
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="model-locationmodel">
|
||||||
|
<th scope="row">
|
||||||
|
<a href="/app_path/inventory/locationmodel/">
|
||||||
|
Locations
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<a class="addlink" href="/app_path/inventory/locationmodel/add/">
|
||||||
|
Add
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="changelink" href="/app_path/inventory/locationmodel/">
|
||||||
|
Change
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="model-memomodel">
|
||||||
|
<th scope="row">
|
||||||
|
<a href="/app_path/inventory/memomodel/">
|
||||||
|
Memos
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<a class="addlink" href="/app_path/inventory/memomodel/add/">
|
||||||
|
Add
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="changelink" href="/app_path/inventory/memomodel/">
|
||||||
|
Change
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="content-related">
|
<div id="content-related">
|
||||||
<div class="module" id="recent-actions-module">
|
<div class="module" id="recent-actions-module">
|
||||||
|
|
Loading…
Add table
Reference in a new issue