mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-18 00:00:00 +00:00
is_manually_set_contact_email (#5702)
* is_manually_set_contact_email * update profile sql
This commit is contained in:
@@ -75,3 +75,5 @@ CREATE TABLE IF NOT EXISTS `sdoc_operation_log` (
|
|||||||
|
|
||||||
ALTER TABLE share_fileshare ADD COLUMN IF NOT EXISTS `user_scope` varchar(225) DEFAULT 'all_users';
|
ALTER TABLE share_fileshare ADD COLUMN IF NOT EXISTS `user_scope` varchar(225) DEFAULT 'all_users';
|
||||||
ALTER TABLE share_fileshare ADD COLUMN IF NOT EXISTS `authed_details` LONGTEXT DEFAULT NULL;
|
ALTER TABLE share_fileshare ADD COLUMN IF NOT EXISTS `authed_details` LONGTEXT DEFAULT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE profile_profile ADD COLUMN IF NOT EXISTS `is_manually_set_contact_email` tinyint(1) DEFAULT 0;
|
||||||
|
@@ -1043,6 +1043,8 @@ class CustomLDAPBackend(object):
|
|||||||
if nickname:
|
if nickname:
|
||||||
Profile.objects.add_or_update(username, nickname=nickname)
|
Profile.objects.add_or_update(username, nickname=nickname)
|
||||||
if contact_email:
|
if contact_email:
|
||||||
|
p = Profile.objects.get_profile_by_user(username)
|
||||||
|
if not (p and p.is_manually_set_contact_email):
|
||||||
Profile.objects.add_or_update(username, contact_email=contact_email)
|
Profile.objects.add_or_update(username, contact_email=contact_email)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f'update ldap user failed {e}')
|
logger.error(f'update ldap user failed {e}')
|
||||||
|
@@ -56,3 +56,4 @@ class DetailedProfileForm(ProfileForm):
|
|||||||
|
|
||||||
contact_email = self.cleaned_data['contact_email']
|
contact_email = self.cleaned_data['contact_email']
|
||||||
Profile.objects.update_contact_email(username, contact_email)
|
Profile.objects.update_contact_email(username, contact_email)
|
||||||
|
Profile.objects.filter(user=username).update(is_manually_set_contact_email=True)
|
||||||
|
@@ -165,6 +165,7 @@ class Profile(models.Model):
|
|||||||
login_id = models.CharField(max_length=225, unique=True, null=True, blank=True)
|
login_id = models.CharField(max_length=225, unique=True, null=True, blank=True)
|
||||||
# Contact email is used to receive emails.
|
# Contact email is used to receive emails.
|
||||||
contact_email = models.EmailField(max_length=225, unique=True, null=True, blank=True)
|
contact_email = models.EmailField(max_length=225, unique=True, null=True, blank=True)
|
||||||
|
is_manually_set_contact_email = models.BooleanField(default=False)
|
||||||
institution = models.CharField(max_length=225, db_index=True, null=True, blank=True, default='')
|
institution = models.CharField(max_length=225, db_index=True, null=True, blank=True, default='')
|
||||||
list_in_address_book = models.BooleanField(default=False, db_index=True)
|
list_in_address_book = models.BooleanField(default=False, db_index=True)
|
||||||
objects = ProfileManager()
|
objects = ProfileManager()
|
||||||
|
@@ -749,6 +749,7 @@ CREATE TABLE `profile_profile` (
|
|||||||
`lang_code` longtext,
|
`lang_code` longtext,
|
||||||
`login_id` varchar(225) DEFAULT NULL,
|
`login_id` varchar(225) DEFAULT NULL,
|
||||||
`contact_email` varchar(225) DEFAULT NULL,
|
`contact_email` varchar(225) DEFAULT NULL,
|
||||||
|
`is_manually_set_contact_email` tinyint(1) DEFAULT 0,
|
||||||
`institution` varchar(225) DEFAULT NULL,
|
`institution` varchar(225) DEFAULT NULL,
|
||||||
`list_in_address_book` tinyint(1) NOT NULL,
|
`list_in_address_book` tinyint(1) NOT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
|
Reference in New Issue
Block a user