forked from Github-Mirrors/canaille
invitation: fixed default fields
This commit is contained in:
parent
489f8414c0
commit
6fa19b85a9
2 changed files with 13 additions and 3 deletions
|
@ -14,7 +14,7 @@ from flask import (
|
||||||
from flask_babel import gettext as _
|
from flask_babel import gettext as _
|
||||||
from flask_themer import render_template
|
from flask_themer import render_template
|
||||||
from werkzeug.datastructures import CombinedMultiDict, FileStorage
|
from werkzeug.datastructures import CombinedMultiDict, FileStorage
|
||||||
from .apputils import b64_to_obj, login_placeholder, profile_hash, obj_to_b64
|
from .apputils import default_fields, b64_to_obj, login_placeholder, profile_hash, obj_to_b64
|
||||||
from .forms import (
|
from .forms import (
|
||||||
InvitationForm,
|
InvitationForm,
|
||||||
LoginForm,
|
LoginForm,
|
||||||
|
@ -242,8 +242,7 @@ def registration(data, hash):
|
||||||
"groups": data[2],
|
"groups": data[2],
|
||||||
}
|
}
|
||||||
|
|
||||||
readable_fields = set(current_app.config["ACL"]["DEFAULT"]["READ"])
|
readable_fields, writable_fields = default_fields()
|
||||||
writable_fields = set(current_app.config["ACL"]["DEFAULT"]["WRITE"])
|
|
||||||
|
|
||||||
form = profile_form(writable_fields, readable_fields)
|
form = profile_form(writable_fields, readable_fields)
|
||||||
form.process(CombinedMultiDict((request.files, request.form)) or None, data=data)
|
form.process(CombinedMultiDict((request.files, request.form)) or None, data=data)
|
||||||
|
|
|
@ -42,6 +42,17 @@ def login_placeholder():
|
||||||
return _(" or ").join(placeholders)
|
return _(" or ").join(placeholders)
|
||||||
|
|
||||||
|
|
||||||
|
def default_fields():
|
||||||
|
read = set()
|
||||||
|
write = set()
|
||||||
|
for acl in current_app.config["ACL"].values():
|
||||||
|
if "filter" not in acl:
|
||||||
|
read |= set(acl.get("READ", []))
|
||||||
|
write |= set(acl.get("WRITE", []))
|
||||||
|
|
||||||
|
return read, write
|
||||||
|
|
||||||
|
|
||||||
def logo():
|
def logo():
|
||||||
logo_url = current_app.config.get("LOGO")
|
logo_url = current_app.config.get("LOGO")
|
||||||
if not logo_url:
|
if not logo_url:
|
||||||
|
|
Loading…
Reference in a new issue