-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give to Editor Level 1 user upload geo-data grant (#594)
* Add capabilities to add files into filemanager to Editor level 1 users. * Add sidebar menu for Editor level 1. * Fix tests. * RAdd testing for creations of a subdirectory inside the settings.DATASOURCE_PATH for Editor Level 1 user. * Typo. * Fix test typos. --------- Co-authored-by: wlorenzetti <[email protected]>
- Loading branch information
1 parent
319b112
commit a419a63
Showing
9 changed files
with
516 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# coding=utf-8 | ||
"""" Django signals receivers | ||
.. note:: This program is free software; you can redistribute it and/or modify | ||
it under the terms of the Mozilla Public License 2.0. | ||
""" | ||
|
||
__author__ = "[email protected]" | ||
__date__ = "2023-08-29" | ||
__copyright__ = "Copyright 2015 - 2023, Gis3w" | ||
__license__ = "MPL 2.0" | ||
|
||
from django.conf import settings | ||
from django.dispatch import receiver | ||
from usersmanage.signals import after_save_user_form | ||
from usersmanage.configs import G3W_EDITOR1 | ||
from usersmanage.utils import userHasGroups | ||
|
||
from os import makedirs, path | ||
import logging | ||
|
||
logger = logging.getLogger('filemanager') | ||
|
||
|
||
|
||
@receiver(after_save_user_form) | ||
def make_project_data_subdir(sender, user, **kwargs): | ||
""" | ||
Given a user instance create if not exists a folder into `settings.DATASOURCE_PATH` | ||
""" | ||
|
||
# Check if user is an Editor level 1 | ||
if not userHasGroups(user, [G3W_EDITOR1]): | ||
return | ||
|
||
makedirs(path.join(settings.DATASOURCE_PATH, user.username), exist_ok=True) | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.