Add feature flag to turn off requirement for team invitations
Fixes #1804
This commit is contained in:
parent
bd9c258ba2
commit
25ed99f9ef
4 changed files with 18 additions and 1 deletions
|
@ -208,6 +208,9 @@ class DefaultConfig(object):
|
||||||
# Docker.
|
# Docker.
|
||||||
FEATURE_LIBRARY_SUPPORT = True
|
FEATURE_LIBRARY_SUPPORT = True
|
||||||
|
|
||||||
|
# Feature Flag: Whether to require invitations when adding a user to a team.
|
||||||
|
FEATURE_REQUIRE_TEAM_INVITE = True
|
||||||
|
|
||||||
# The namespace to use for library repositories.
|
# The namespace to use for library repositories.
|
||||||
# Note: This must remain 'library' until Docker removes their hard-coded namespace for libraries.
|
# Note: This must remain 'library' until Docker removes their hard-coded namespace for libraries.
|
||||||
# See: https://github.com/docker/docker/blob/master/registry/session.go#L320
|
# See: https://github.com/docker/docker/blob/master/registry/session.go#L320
|
||||||
|
|
|
@ -41,8 +41,9 @@ def try_accept_invite(code, user):
|
||||||
|
|
||||||
|
|
||||||
def handle_addinvite_team(inviter, team, user=None, email=None):
|
def handle_addinvite_team(inviter, team, user=None, email=None):
|
||||||
|
requires_invite = features.MAILING and features.REQUIRE_TEAM_INVITE
|
||||||
invite = model.team.add_or_invite_to_team(inviter, team, user, email,
|
invite = model.team.add_or_invite_to_team(inviter, team, user, email,
|
||||||
requires_invite=features.MAILING)
|
requires_invite=requires_invite)
|
||||||
if not invite:
|
if not invite:
|
||||||
# User was added to the team directly.
|
# User was added to the team directly.
|
||||||
return
|
return
|
||||||
|
|
|
@ -74,6 +74,18 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr ng-show="config.FEATURE_MAILING">
|
||||||
|
<td class="non-input">Team Invitations:</td>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="config-bool-field" binding="config.FEATURE_REQUIRE_TEAM_INVITE">
|
||||||
|
Require Team Invitations
|
||||||
|
</div>
|
||||||
|
<div class="help-text">
|
||||||
|
If enabled, when adding a new user to a team, they will receive an invitation to join the team, with the option to decline.
|
||||||
|
Otherwise, users will be immediately part of a team when added by a team administrator.
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,7 @@ def add_enterprise_config_defaults(config_obj, current_secret_key, hostname):
|
||||||
config_obj['FEATURE_USER_LOG_ACCESS'] = config_obj.get('FEATURE_USER_LOG_ACCESS', True)
|
config_obj['FEATURE_USER_LOG_ACCESS'] = config_obj.get('FEATURE_USER_LOG_ACCESS', True)
|
||||||
config_obj['FEATURE_USER_CREATION'] = config_obj.get('FEATURE_USER_CREATION', True)
|
config_obj['FEATURE_USER_CREATION'] = config_obj.get('FEATURE_USER_CREATION', True)
|
||||||
config_obj['FEATURE_ANONYMOUS_ACCESS'] = config_obj.get('FEATURE_ANONYMOUS_ACCESS', True)
|
config_obj['FEATURE_ANONYMOUS_ACCESS'] = config_obj.get('FEATURE_ANONYMOUS_ACCESS', True)
|
||||||
|
config_obj['FEATURE_REQUIRE_TEAM_INVITE'] = config_obj.get('FEATURE_REQUIRE_TEAM_INVITE', True)
|
||||||
|
|
||||||
# Default features that are off.
|
# Default features that are off.
|
||||||
config_obj['FEATURE_MAILING'] = config_obj.get('FEATURE_MAILING', False)
|
config_obj['FEATURE_MAILING'] = config_obj.get('FEATURE_MAILING', False)
|
||||||
|
|
Reference in a new issue