Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael William Coughlin
GraceDB Server
Commits
d3ef5a17
Commit
d3ef5a17
authored
5 years ago
by
Tanner Prestegard
Committed by
GraceDB
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add 'is_internal' utility for checking user memberships
parent
f96b0397
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gracedb/ligoauth/context_processors.py
+4
-1
4 additions, 1 deletion
gracedb/ligoauth/context_processors.py
gracedb/ligoauth/utils.py
+5
-0
5 additions, 0 deletions
gracedb/ligoauth/utils.py
with
9 additions
and
1 deletion
gracedb/ligoauth/context_processors.py
+
4
−
1
View file @
d3ef5a17
from
django.conf
import
settings
from
.utils
import
is_internal
def
LigoAuthContext
(
request
):
user_is_internal
=
False
user_is_lvem
=
False
user_is_advocate
=
False
# user is an EM advocate
if
request
.
user
:
if
request
.
user
.
groups
.
filter
(
name
=
settings
.
LVC_GROUP
).
exists
(
):
if
is_internal
(
request
.
user
):
user_is_internal
=
True
if
request
.
user
.
groups
.
filter
(
name
=
settings
.
LVEM_GROUP
).
exists
():
user_is_lvem
=
True
...
...
This diff is collapsed.
Click to expand it.
gracedb/ligoauth/utils.py
+
5
−
0
View file @
d3ef5a17
from
django.conf
import
settings
from
django.http
import
HttpResponseForbidden
from
django.utils.functional
import
wraps
def
groups_allowed
(
group_names
):
"""
Decorator to allow access to specified group(s).
...
...
@@ -23,3 +25,6 @@ def groups_allowed(group_names):
return
wrapper
return
decorator
def
is_internal
(
user
):
return
user
.
groups
.
filter
(
name
=
settings
.
LVC_GROUP
).
exists
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment