SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
SciPost
SciPost
Commits
e0bf4cb8
Commit
e0bf4cb8
authored
6 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
Add permissions and group to transfer_contact_data temp method
parent
4281f8c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
organizations/management/commands/transfer_contact_data.py
+12
-1
12 additions, 1 deletion
organizations/management/commands/transfer_contact_data.py
with
12 additions
and
1 deletion
organizations/management/commands/transfer_contact_data.py
+
12
−
1
View file @
e0bf4cb8
...
@@ -4,9 +4,12 @@ __license__ = "AGPL v3"
...
@@ -4,9 +4,12 @@ __license__ = "AGPL v3"
import
datetime
import
datetime
from
django.contrib.auth.models
import
Group
from
django.core.management.base
import
BaseCommand
from
django.core.management.base
import
BaseCommand
from
django.utils
import
timezone
from
django.utils
import
timezone
from
guardian.shortcuts
import
assign_perm
from
partners.models
import
Partner
from
partners.models
import
Partner
from
organizations.models
import
Contact
,
ContactRole
from
organizations.models
import
Contact
,
ContactRole
...
@@ -14,7 +17,9 @@ from organizations.models import Contact, ContactRole
...
@@ -14,7 +17,9 @@ from organizations.models import Contact, ContactRole
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
help
=
(
'
For Partners, transfer the data of partners.Contact instances
'
help
=
(
'
For Partners, transfer the data of partners.Contact instances
'
'
to organizations.Contact and ContactRole instances.
'
)
'
to organizations.Contact and ContactRole instances.
'
'
This is meant as a temporary, one-off method to be used during
'
'
deprecation of (Prospective)Partners.
'
)
def
handle
(
self
,
*
args
,
**
kwargs
):
def
handle
(
self
,
*
args
,
**
kwargs
):
for
partner
in
Partner
.
objects
.
all
():
for
partner
in
Partner
.
objects
.
all
():
...
@@ -26,6 +31,12 @@ class Command(BaseCommand):
...
@@ -26,6 +31,12 @@ class Command(BaseCommand):
key_expires
=
oldcontact
.
key_expires
key_expires
=
oldcontact
.
key_expires
)
)
contact
.
save
()
contact
.
save
()
# Assign permissions and Group
assign_perm
(
'
can_view_org_contacts
'
,
oldcontact
.
user
,
partner
.
organization
)
orgcontacts
=
Group
.
objects
.
get
(
name
=
'
Organization Contacts
'
)
oldcontact
.
user
.
groups
.
add
(
orgcontacts
)
contactrole
=
ContactRole
(
contactrole
=
ContactRole
(
contact
=
contact
,
contact
=
contact
,
organization
=
partner
.
organization
,
organization
=
partner
.
organization
,
...
...
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