Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos.core
Commits
445cd24d
Commit
445cd24d
authored
Aug 11, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_subscription_request: fix user account assignment creation from SubscriptionRequest
parent
2727476e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
21 deletions
+12
-21
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_boostrapUserAccount.py
...iption_request/SubscriptionRequest_boostrapUserAccount.py
+12
-20
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+0
-1
No files found.
master/bt5/slapos_subscription_request/SkinTemplateItem/portal_skins/slapos_subscription_request/SubscriptionRequest_boostrapUserAccount.py
View file @
445cd24d
...
...
@@ -13,22 +13,22 @@ if person.getLanguage() in [None, ""]:
person
.
setLanguage
(
context
.
getLanguage
())
# Should come from subscription condition probably or preference
role_list
=
[
'member'
,
'subscrib
er'
]
function_list
=
[
'custom
er'
]
open_assignment_list
=
person
.
searchFolder
(
portal_type
=
"Assignment"
,
validation_state
=
"open"
)
current_assignment_list
=
{}
for
assignment
in
open_assignment_list
:
role
=
assignment
.
getRole
()
if
role
in
current_assignment_list
:
current_assignment_list
[
role
].
append
(
assignment
)
function
=
assignment
.
getFunction
()
if
function
in
current_assignment_list
:
current_assignment_list
[
function
].
append
(
assignment
)
else
:
current_assignment_list
[
role
]
=
[
assignment
]
current_assignment_list
[
function
]
=
[
assignment
]
for
role
in
role
_list
:
if
role
in
current_assignment_list
:
for
function
in
function
_list
:
if
function
in
current_assignment_list
:
# Update assignment (Reset stop/start dates)
for
assignment
in
current_assignment_list
[
role
]:
for
assignment
in
current_assignment_list
[
function
]:
if
assignment
.
getStartDate
()
is
None
or
\
assignment
.
getStopDate
()
is
None
:
assignment
.
update
()
...
...
@@ -40,8 +40,10 @@ for role in role_list:
# Create assignment
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
,
title
=
'%s Assignment'
%
(
role
.
capitalize
()),
role
=
role
)
title
=
'%s Assignment'
%
(
function
.
capitalize
()),
function
=
function
,
destination_project
=
context
.
getSourceProject
()
)
assignment
.
open
(
comment
=
"Created by Subscription Request"
)
...
...
@@ -68,16 +70,6 @@ try:
except
UnsupportedWorkflowMethod
:
pass
person
.
edit
(
default_career_role_list
=
role_list
)
default_career
=
getattr
(
person
,
'default_career'
,
None
)
# Try to validate the default career
try
:
default_career
.
start
(
comment
=
"Started by Subscription Request"
)
default_career
.
setStartDate
(
DateTime
())
except
UnsupportedWorkflowMethod
:
pass
context
.
activate
(
activity
=
'SQLQueue'
).
SubscriptionRequest_sendAcceptedNotification
(
reference
,
password
)
context
.
order
()
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
445cd24d
...
...
@@ -989,7 +989,6 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self
.
assertEqual
(
len
(
login_list
),
1
)
self
.
assertEqual
(
login_list
[
0
].
getReference
(),
person
.
getDefaultEmailText
())
self
.
assertSameSet
(
person
.
getRoleList
(),
[
"member"
,
"subscriber"
])
def
checkEmailNotification
(
self
,
subscription_request
,
notification_message
=
"subscription_request-confirmation-with-password"
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment