Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
SMASCH
scheduling-system
Commits
6ca347b1
Commit
6ca347b1
authored
6 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
added method add_permissions_to_worker to functions for Issue
#31
tests
parent
7f20ff18
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!192
Feature/add way to change password and PERMISSIONS
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/tests/functions.py
+6
-0
6 additions, 0 deletions
smash/web/tests/functions.py
with
6 additions
and
0 deletions
smash/web/tests/functions.py
+
6
−
0
View file @
6ca347b1
...
...
@@ -13,6 +13,7 @@ from web.models.constants import REDCAP_TOKEN_CONFIGURATION_TYPE, REDCAP_BASE_UR
from
web.models.worker_study_role
import
ROLE_CHOICES_DOCTOR
,
WORKER_VOUCHER_PARTNER
from
web.redcap_connector
import
RedcapSubject
from
web.views.notifications
import
get_today_midnight_date
from
django.contrib.auth.models
import
Permission
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -238,6 +239,11 @@ def create_user(username=None, password=None):
create_worker
(
user
)
return
user
def
add_permissions_to_worker
(
worker
,
codenames
):
roles
=
WorkerStudyRole
.
objects
.
filter
(
worker
=
worker
,
study_id
=
GLOBAL_STUDY_ID
)
perms
=
Permission
.
objects
.
filter
(
codename__in
=
codenames
).
all
()
roles
[
0
].
permissions
.
set
(
perms
)
roles
[
0
].
save
()
def
create_worker
(
user
=
None
,
with_test_location
=
False
):
worker
=
Worker
.
objects
.
create
(
...
...
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