diff --git a/invenio_config_tuw/auth/utils.py b/invenio_config_tuw/auth/utils.py index c7c73a1492c52c02223b4261312d9f09557b8b9a..6373150b7c0af015041aa55e5c0b5225104ba033 100644 --- a/invenio_config_tuw/auth/utils.py +++ b/invenio_config_tuw/auth/utils.py @@ -45,30 +45,16 @@ def _get_or_create_role(role_name, description): def auto_trust_user(user): """Automatically trust newly registered users if that's configured.""" auto_trust_enabled = current_app.config.get("CONFIG_TUW_AUTO_TRUST_USERS") - auto_allow_publish_enabled = current_app.config.get("CONFIG_TUW_AUTO_ALLOW_PUBLISH") trust_check = current_app.config.get("CONFIG_TUW_AUTO_TRUST_CONDITION", None) - allow_publish_check = current_app.config.get( - "CONFIG_TUW_AUTO_ALLOW_PUBLISH_CONDITION", None - ) if user and auto_trust_enabled: # if the user was created successfully and auto-trust is enabled... trusted_user = _get_or_create_role( - "trusted-user", "Users trusted with extra permissions" - ) - trusted_publisher = _get_or_create_role( - "trusted-publisher", "Users trusted with publication rights" + "trusted-user", "Users trusted with upload permissions" ) # if no trust condition is specified, trust the user if trust_check is None or trust_check(user): # NOTE: the add_role_to_user function is idempotent current_datastore.add_role_to_user(user, trusted_user) - - # perform similar checks for auto-allow-publish - if auto_allow_publish_enabled and ( - allow_publish_check is None or allow_publish_check(user) - ): - current_datastore.add_role_to_user(user, trusted_publisher) - db.session.commit() diff --git a/invenio_config_tuw/config.py b/invenio_config_tuw/config.py index d248c74560672f0ab2d56cf0250cecd6a5411f56..3f09b57d9341e9c517bac582289bafb8e7bbb888 100644 --- a/invenio_config_tuw/config.py +++ b/invenio_config_tuw/config.py @@ -37,15 +37,6 @@ This must be a function that accepts a 'user' argument and returns a boolean val Alternatively, it can be set to None. This is the same as ``lambda u: True``. """ -CONFIG_TUW_AUTO_ALLOW_PUBLISH = True -"""Whether or not to auto-assign the 'trusted-publisher' role to new users. - -Note: This setting will only come into play if AUTO_TURST_USERS is enabled. -""" - -CONFIG_TUW_AUTO_ALLOW_PUBLISH_CONDITION = check_user_email_for_tuwien -"""Similar to AUTO_TRUST_CONDITION, but for the 'trusted-publisher' role.""" - CONFIG_TUW_READ_ONLY_MODE = False """Disallow insert and update operations in the repository."""