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

Bugfix: Do not strip domain when changing ACL #1042

Merged
merged 2 commits into from
Nov 20, 2019
Merged
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
12 changes: 9 additions & 3 deletions timesketch/api/v1/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2426,9 +2426,15 @@ def post(self, sketch_id):
'The user does not have write permission on the sketch.')

for username in form.get('users', []):
base_username = username.split('@')[0]
base_username = base_username.strip()
user = User.query.filter_by(username=base_username).first()
# Try the username with any potential @domain preserved.
user = User.query.filter_by(username=username).first()

# If no hit, then try to strip the domain.
if not user:
base_username = username.split('@')[0]
base_username = base_username.strip()
user = User.query.filter_by(username=base_username).first()

if user:
sketch.grant_permission(permission='read', user=user)
sketch.grant_permission(permission='write', user=user)
Expand Down