Allow enterprise customers to disable name changes

(imported from commit 1f2039f3e88a4ec0cc48dba75f714563c1de4af8)
This commit is contained in:
Leo Franchi 2013-11-15 10:52:31 -05:00
parent b12649e548
commit 7f2936a985
4 changed files with 16 additions and 2 deletions

View File

@ -55,12 +55,16 @@ $(function () {
avatar.build_user_avatar_widget(upload_avatar);
if (page_params.domain === "users.customer4.invalid") {
if (page_params.domain === "users.customer4.invalid" ||
page_params.name_changes_disabled) {
// At the request of the facilitators, CUSTOMER4 users
// can't change their names, so don't show that as a settings
// option. This is also disabled through the JSON UI. Once we
// have the infrastructure for administrative policies, we can
// handle this more gracefully.
//
// Additionally, if this install has disabled name changes, hide the
// container
$("#name_change_container").hide();
}

View File

@ -725,6 +725,7 @@ def home(request):
muted_topics = register_ret['muted_topics'],
show_admin = user_profile.show_admin,
notify_for_streams_by_default = notify_for_streams_by_default(user_profile),
name_changes_disabled = settings.NAME_CHANGES_DISABLED,
has_mobile_devices = num_push_devices_for_user(user_profile) > 0
))
@ -1745,11 +1746,15 @@ def json_change_settings(request, user_profile,
result = {}
if user_profile.full_name != full_name and full_name.strip() != "":
if user_profile.realm.domain == "users.customer4.invalid":
if settings.NAME_CHANGES_DISABLED or \
user_profile.realm.domain == "users.customer4.invalid":
# At the request of the facilitators, CUSTOMER4
# students can't change their names. Failingly silently is
# fine -- they can't do it through the UI, so they'd have
# to be trying to break the rules.
#
# Additionally, if this install has disabled name changes altogether,
# ignore name changes as well
pass
else:
new_full_name = full_name.strip()

View File

@ -71,6 +71,10 @@ INLINE_IMAGE_PREVIEW = True
# setting up the appropriate integration.
LOCAL_UPLOADS_DIR = "/home/zulip/uploads"
# Controls whether name changes are completely disabled for this installation
# This is useful in settings where you're syncing names from an integrated LDAP/Active Directory
NAME_CHANGES_DISABLED = False
### TWITTER INTEGRATION
# Zulip supports showing inline Tweet previews when a tweet is linked

View File

@ -246,6 +246,7 @@ DEFAULT_SETTINGS = {'TWITTER_CONSUMER_KEY': '',
'LOCAL_UPLOADS_DIR': None,
'DROPBOX_APP_KEY': '',
'ERROR_REPORTING': True,
'NAME_CHANGES_DISABLED': False,
'DEPLOYMENT_ROLE_NAME': ADMIN_DOMAIN,
# The following bots only exist in non-ENTERPRISE installs
'ERROR_BOT': None,