diff --git a/pagure/default_config.py b/pagure/default_config.py index bc6c762..025b27c 100644 --- a/pagure/default_config.py +++ b/pagure/default_config.py @@ -187,6 +187,10 @@ BLACKLISTED_PROJECTS = [ # List of prefix allowed in project names ALLOWED_PREFIX = [] +# List of blacklisted group names +BLACKLISTED_GROUPS = ['forks'] + + ACLS = { 'issue_create': 'Create a new ticket against this project', 'issue_change_status': 'Change the status of a ticket of this project', diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 2683afe..bba7104 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -2444,13 +2444,17 @@ def delete_user_of_group(session, username, groupname, user, is_admin): session.flush() -def add_group(session, group_name, group_type, user, is_admin): +def add_group(session, group_name, group_type, user, is_admin, blacklist): ''' Creates a new group with the given information. ''' if ' ' in group_name: raise pagure.exceptions.PagureException( 'Spaces are not allowed in group names: %s' % group_name) + if group_name in blacklist: + raise pagure.exceptions.PagureException( + 'The group names are forbidden: %s' % blacklist) + group_types = ['user'] if is_admin: group_types = [ diff --git a/pagure/ui/groups.py b/pagure/ui/groups.py index 7e311a2..7d0ebb3 100644 --- a/pagure/ui/groups.py +++ b/pagure/ui/groups.py @@ -231,6 +231,7 @@ def add_group(): group_type=form.group_type.data, user=flask.g.fas_user.username, is_admin=pagure.is_admin(), + blacklist=pagure.APP.config['BLACKLISTED_GROUPS'], ) pagure.SESSION.commit() flask.flash('Group `%s` created.' % group_name)