-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app/permissions: Move permissions data out of LDAP, introduce a new 'app core' config panel allowing to change the app logo, label, etc. #1917
Conversation
30015ca
to
ab7a33b
Compare
6ac59cc
to
c5580a0
Compare
c5580a0
to
9340666
Compare
0175053
to
b31c49d
Compare
2b651cf
to
6896dc8
Compare
6896dc8
to
a0960b6
Compare
77d78fc
to
0770277
Compare
0770277
to
c2a3fc4
Compare
8de021b
to
40dfb00
Compare
Currently,
If you have hundreds of users, you have for each permissions and in each of this file, all allowed users listed, even if you use groups to define those permission. I understand that we need some cache to avoid perf issue with ldap request. Could it be possible to factorize those file with something like:
And refer to it in
Next we could recompile the "flat" list of allowed users in
Or even directly give read write on May be an other PR. It's just it seems to me quite annoying to have tons of users listed in each apps main permissions. |
c7f75ab
to
90c7283
Compare
…on, order, hide from public app list view
2b19d29
to
fc64aae
Compare
…sion stuff and upgrade/change_url/uninstall the app
fc64aae
to
1536ae1
Compare
…deprovisioning perms
…perseded by migration 0033
…lled, triggered via the config panel
…ified file path for some reason
@@ -184,6 +184,32 @@ | |||
if key in domain_settings_with_help_key: | |||
yield f"domain_config_{key}_help" | |||
|
|||
# App config panel | |||
app_config = toml.load(open(ROOT + "share/config_app.toml")) |
Check warning
Code scanning / CodeQL
File is not always closed Warning
@@ -69,7 +79,7 @@ | |||
if TYPE_CHECKING: | |||
from pydantic.typing import AbstractSetIntStr, MappingIntStrAny | |||
|
|||
from yunohost.utils.configpanel import ConfigPanelModel, RawSettings | |||
from yunohost.utils.configpanel import ConfigPanelModel, RawSettings, RawConfig |
Check notice
Code scanning / CodeQL
Unused import Note
Import of 'RawSettings' is not used.
Import of 'RawConfig' is not used.
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 9 days ago
To fix the problem, we need to remove the unused imports from the code. Specifically, we should delete the line that imports ConfigPanelModel
, RawSettings
, and RawConfig
from yunohost.utils.configpanel
. This will clean up the code and remove the unnecessary dependency.
-
Copy modified line R82
@@ -81,3 +81,3 @@ | ||
|
||
from yunohost.utils.configpanel import ConfigPanelModel, RawSettings, RawConfig | ||
|
||
from yunohost.utils.form import FormModel |
return AppConfigPanel(app).run_action( | ||
action, args=args, args_file=args_file, operation_logger=operation_logger | ||
) | ||
def app_action_run(app, action, args=None, args_file=None, core=False): |
Check notice
Code scanning / CodeQL
Explicit returns mixed with implicit (fall through) returns Note
@@ -2061,7 +2062,10 @@ | |||
# - we doesn't want to give a specific value | |||
# - we want to keep the previous value | |||
# - we want the default value | |||
context[option.id] = None | |||
if option.readonly: | |||
context[option.id] = option.normalize(form[option.id]) |
Check failure
Code scanning / CodeQL
Modification of parameter with default Error
default value
if option.readonly: | ||
context[option.id] = option.normalize(form[option.id]) | ||
else: | ||
context[option.id] = None |
Check failure
Code scanning / CodeQL
Modification of parameter with default Error
The problem
As foretold a while ago, for various reason, we are going to want to tweak the permission datastructure (because of the auth header policy evolution, or being able to tweak the label, description, logo in the portal) and all the infos are currently in LDAP for not real reason beyond the fact that this is where we store the user<->group<->ACL relationships - but all the other infos (label, url, show_tile etc.) are only meant to be used by ssowat without relying on LDAP.
This is not practical because everytime we want to change the datastructure, we need an LDAP migration, and having everything in settings would also to just simply be able to edit a flat yaml text file which has plenty of benefits.
Solution
_permissions
key which is adict
mapping each perm to the corresponding infos/etc/yunohost/permissions.yml
_sync_permissions_with_ldap
which may also be called manually from CLI usingyunohot user permissions ldapsync
... this CLI command is mainly here for debugging purpose and/or scenario in which somebody tweaks access rights manually in the app settings ... Kind of similar toyunohost app ssowatconf
--short
option foryunohost user permission list
because it was pretty much unused and confusing because the return type of the function was different with/without this optionyunohost user permission reset <app>
because it's pretty much unused and exists mainly because of the legacy permission systemuser_permission_create/update/delete
do not generate an operation log anymore because it felt a bit bloated that it did ... especially now that what it does is mainly to edit the app settings ... but admin-triggered operation like user_permission_update (from CLI/API) or add/remove members will generate a "flash" operationPR Status
Yolodraft
How to test
...