Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preview Dannon diff #22

Open
wants to merge 1 commit into
base: cloudve_ci
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions lib/galaxy/managers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,28 @@ def create(self, email=None, username=None, password=None, **kwargs):
"""
Create a new user.
"""
self._error_on_duplicate_email(email)
user = self.model_class(email=email)
if password:
user.set_password_cleartext(password)
else:
user.set_random_password()
user.username = username
if self.app.config.user_activation_on:
user.active = False
else:
# Activation is off, every new user is active by default.
user.active = True
self.session().add(user)
try:
self.session().flush()
# TODO:?? flush needed for permissions below? If not, make optional
except exc.IntegrityError as db_err:
raise exceptions.Conflict(str(db_err))
self.app.security_agent.create_user_role(user, self.app)
return user
from galaxy.util.filelock import FileLock
with FileLock('user_creation'):
self._error_on_duplicate_email(email)
user = self.model_class(email=email)
if password:
user.set_password_cleartext(password)
else:
user.set_random_password()
user.username = username
if self.app.config.user_activation_on:
user.active = False
else:
# Activation is off, every new user is active by default.
user.active = True
self.session().add(user)
try:
self.session().flush()
# TODO:?? flush needed for permissions below? If not, make optional
except exc.IntegrityError as db_err:
raise exceptions.Conflict(str(db_err))
self.app.security_agent.create_user_role(user, self.app)
return user

def delete(self, user, flush=True):
"""Mark the given user deleted."""
Expand Down