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
0
Merge Requests
0
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
Nicolas Wavrant
slapos.core
Commits
925a2770
Commit
925a2770
authored
Jul 02, 2019
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Allow User invite other user to a Project
parent
f66a381c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
582 additions
and
9 deletions
+582
-9
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_html.html
...dget_erp5_page_slap_project_get_invitation_link_html.html
+26
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_html.xml
...adget_erp5_page_slap_project_get_invitation_link_html.xml
+156
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_js.js
...s_gadget_erp5_page_slap_project_get_invitation_link_js.js
+120
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_js.xml
..._gadget_erp5_page_slap_project_get_invitation_link_js.xml
+152
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_view_js.js
..._page_module/rjs_gadget_erp5_page_slap_project_view_js.js
+3
-1
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_view_js.xml
...page_module/rjs_gadget_erp5_page_slap_project_view_js.xml
+3
-3
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_appcache.xml
...mplateItem/web_page_module/rjs_gadget_slapos_appcache.xml
+4
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getInvitationLink.py
...tal_skins/slapos_hal_json_style/Base_getInvitationLink.py
+4
-2
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Organisation_acceptInvitation.py
...ns/slapos_hal_json_style/Organisation_acceptInvitation.py
+1
-1
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Project_acceptInvitation.py
...l_skins/slapos_hal_json_style/Project_acceptInvitation.py
+41
-0
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Project_acceptInvitation.xml
..._skins/slapos_hal_json_style/Project_acceptInvitation.xml
+70
-0
master/bt5/slapos_jio/bt/template_path_list
master/bt5/slapos_jio/bt/template_path_list
+2
-0
No files found.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_html.html
0 → 100644
View file @
925a2770
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
OfficeJS Add Text Document
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_erp5_page_slap_organisation_get_invitation_link.js"
></script>
</head>
<body>
<form
class=
"save_form ui-body-c"
novalidate
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"
></button>
<div
data-gadget-url=
"gadget_erp5_form.html"
data-gadget-scope=
"form_view"
data-gadget-sandbox=
"public"
>
</div>
</form>
</body>
</html>
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_html.xml
0 → 100644
View file @
925a2770
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Page"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
contributor/person_module/1
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
<item>
<key>
<string>
creators
</string>
</key>
<value>
<tuple>
<string>
cedric.le.ninivin
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_erp5_page_slap_project_get_invitation_link.html
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
rjs_gadget_erp5_page_slap_project_get_invitation_link_html
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
modification_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1455284351.46
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Page
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Slap Project Get Invitation Link
</string>
</value>
</item>
<item>
<key>
<string>
url_string
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
001
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_js.js
0 → 100644
View file @
925a2770
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
return
this
.
triggerSubmit
();
})
.
onEvent
(
'
submit
'
,
function
()
{
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
})
.
push
(
function
(
doc
)
{
return
gadget
.
getSetting
(
"
hateoas_url
"
)
.
push
(
function
(
url
)
{
return
gadget
.
jio_getAttachment
(
doc
.
relative_url
,
url
+
doc
.
relative_url
+
"
/Base_getInvitationLink
"
);
})
.
push
(
function
(
result
)
{
return
gadget
.
notifySubmitted
({
message
:
"
New Invitation link generated.
"
,
status
:
'
success
'
})
.
push
(
function
()
{
// Workaround, find a way to open document without break gadget.
result
.
jio_key
=
doc
.
relative_url
;
return
gadget
.
render
(
result
);
});
});
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
return
this
.
element
.
querySelector
(
'
button[type="submit"]
'
).
click
();
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getDeclaredGadget
(
'
form_view
'
)
]);
})
.
push
(
function
(
result
)
{
return
result
[
0
].
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
my_relative_url
"
:
{
"
description
"
:
""
,
"
title
"
:
"
Parent Relative Url
"
,
"
default
"
:
options
.
jio_key
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
relative_url
"
,
"
hidden
"
:
1
,
"
type
"
:
"
StringField
"
},
"
my_invitation_link
"
:
{
"
description
"
:
""
,
"
title
"
:
"
Your Invitation Link
"
,
"
default
"
:
options
.
invitation_link
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
0
,
"
key
"
:
"
invitation_link
"
,
"
hidden
"
:
(
options
.
invitation_link
===
undefined
)
?
1
:
0
,
"
type
"
:
"
StringField
"
}
}},
"
_links
"
:
{
"
type
"
:
{
// form_list display portal_type in header
name
:
""
}
}
},
form_definition
:
{
group_list
:
[[
"
center
"
,
[[
"
my_invitation_link
"
],
[
"
my_relative_url
"
]]
]]
}
});
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
'
history_previous
'
})
]);
})
.
push
(
function
(
url_list
)
{
var
header_dict
=
{
page_title
:
"
Generate New Invitation Link
"
,
submit_action
:
true
,
selection_url
:
url_list
[
0
]
};
return
gadget
.
updateHeader
(
header_dict
);
});
});
}(
window
,
rJS
,
RSVP
));
\ No newline at end of file
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_js.xml
0 → 100644
View file @
925a2770
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Web Script"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Change_local_roles_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
contributor/person_module/1
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
content_md5
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
creators
</string>
</key>
<value>
<tuple>
<string>
cedric.le.ninivin
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_erp5_page_slap_project_get_invitation_link.js
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
rjs_gadget_erp5_page_slap_project_get_invitation_link_js
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
modification_date
</string>
</key>
<value>
<object>
<klass>
<global
name=
"DateTime"
module=
"DateTime.DateTime"
/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>
1455284351.49
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Web Script
</string>
</value>
</item>
<item>
<key>
<string>
short_title
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
SlapOS Project Get Invitation Link JS
</string>
</value>
</item>
<item>
<key>
<string>
url_string
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
001
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_view_js.js
View file @
925a2770
...
@@ -194,7 +194,8 @@
...
@@ -194,7 +194,8 @@
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
editable
:
true
}}),
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
editable
:
true
}}),
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
page
:
"
slap_delete_project
"
}})
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
page
:
"
slap_delete_project
"
}}),
gadget
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
page
:
"
slap_project_get_invitation_link
"
}})
]);
]);
})
})
.
push
(
function
(
url_list
)
{
.
push
(
function
(
url_list
)
{
...
@@ -202,6 +203,7 @@
...
@@ -202,6 +203,7 @@
selection_url
:
url_list
[
1
],
selection_url
:
url_list
[
1
],
page_title
:
"
Project :
"
+
gadget
.
state
.
doc
.
title
,
page_title
:
"
Project :
"
+
gadget
.
state
.
doc
.
title
,
delete_url
:
url_list
[
2
],
delete_url
:
url_list
[
2
],
invitation_url
:
url_list
[
3
],
save_action
:
true
save_action
:
true
};
};
if
(
!
gadget
.
state
.
editable
)
{
if
(
!
gadget
.
state
.
editable
)
{
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_project_view_js.xml
View file @
925a2770
...
@@ -227,7 +227,7 @@
...
@@ -227,7 +227,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
superrafael
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -241,7 +241,7 @@
...
@@ -241,7 +241,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.
51731.9751.49032
</string>
</value>
<value>
<string>
974.
62049.17150.785
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -259,7 +259,7 @@
...
@@ -259,7 +259,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
54315625.4
3
</float>
<float>
15
62091422.1
3
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_slapos_appcache.xml
View file @
925a2770
...
@@ -261,6 +261,8 @@ gadget_erp5_page_slap_add_organisation.html\n
...
@@ -261,6 +261,8 @@ gadget_erp5_page_slap_add_organisation.html\n
gadget_erp5_page_slap_add_organisation.js\n
gadget_erp5_page_slap_add_organisation.js\n
gadget_erp5_page_slap_organisation_get_invitation_link.js\n
gadget_erp5_page_slap_organisation_get_invitation_link.js\n
gadget_erp5_page_slap_organisation_get_invitation_link.html\n
gadget_erp5_page_slap_organisation_get_invitation_link.html\n
gadget_erp5_page_slap_project_get_invitation_link.js\n
gadget_erp5_page_slap_project_get_invitation_link.html\n
gadget_erp5_page_slap_add_project.html\n
gadget_erp5_page_slap_add_project.html\n
gadget_erp5_page_slap_add_project.js\n
gadget_erp5_page_slap_add_project.js\n
gadget_erp5_page_slap_add_related_event.html\n
gadget_erp5_page_slap_add_related_event.html\n
...
@@ -571,7 +573,7 @@ NETWORK:\n
...
@@ -571,7 +573,7 @@ NETWORK:\n
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
976.
40666.4477.59699
</string>
</value>
<value>
<string>
976.
53162.22511.22903
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -589,7 +591,7 @@ NETWORK:\n
...
@@ -589,7 +591,7 @@ NETWORK:\n
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15620
33682.52
</float>
<float>
15620
93475.71
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getInvitationLink.py
View file @
925a2770
...
@@ -4,13 +4,15 @@ from zExceptions import Unauthorized
...
@@ -4,13 +4,15 @@ from zExceptions import Unauthorized
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
if
context
.
getPortalType
()
!=
"Organisation"
:
# Only Project and Organisation can generate an invitation
if
context
.
getPortalType
()
not
in
[
"Organisation"
,
"Project"
]:
raise
Unauthorized
raise
Unauthorized
web_site
=
context
.
getWebSiteValue
()
web_site
=
context
.
getWebSiteValue
()
request_method
=
"POST"
request_method
=
"POST"
script_name
=
"%s_acceptInvitation"
%
context
.
getPortalType
()
request_url
=
"%s/%s/%s"
%
(
web_site
.
absolute_url
(),
context
.
getRelativeUrl
(),
"Organisation_acceptInvitation"
)
request_url
=
"%s/%s/%s"
%
(
web_site
.
absolute_url
(),
context
.
getRelativeUrl
(),
script_name
)
# Maybe it would be better to use another portal_type
# Maybe it would be better to use another portal_type
access_token
=
portal
.
invitation_token_module
.
newContent
(
access_token
=
portal
.
invitation_token_module
.
newContent
(
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Organisation_acceptInvitation.py
View file @
925a2770
...
@@ -32,7 +32,7 @@ for assignment in person.objectValues(portal_type="Assignment"):
...
@@ -32,7 +32,7 @@ for assignment in person.objectValues(portal_type="Assignment"):
return
"Already had stuff"
return
"Already had stuff"
person
.
newContent
(
person
.
newContent
(
title
=
"Assigment for
Site
%s"
%
context
.
getTitle
(),
title
=
"Assigment for
Organisation
%s"
%
context
.
getTitle
(),
portal_type
=
"Assignment"
,
portal_type
=
"Assignment"
,
destination_value
=
context
).
open
()
destination_value
=
context
).
open
()
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Project_acceptInvitation.py
0 → 100644
View file @
925a2770
from
zExceptions
import
Unauthorized
portal
=
context
.
getPortalObject
()
if
invitation_token
is
None
:
raise
ValueError
(
"Invitation Token is required"
)
if
context
.
getPortalType
()
!=
"Project"
:
raise
Unauthorized
(
"Context is not an Organisation"
)
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
if
person
is
None
:
raise
ValueError
(
"You must be logged in!"
)
try
:
invitation_token
=
portal
.
invitation_token_module
[
invitation_token
]
except
KeyError
:
raise
ValueError
(
"Invitation Token is not found."
)
if
invitation_token
.
getPortalType
()
!=
"Invitation Token"
:
raise
ValueError
(
"Invitation Token is not found."
)
if
invitation_token
.
getValidationState
()
!=
"validated"
:
raise
ValueError
(
"Invitation Token was already used."
)
if
invitation_token
.
getSourceValue
()
==
person
:
raise
ValueError
(
"Invitation Token cannot be used by the same user that generated the token!"
)
for
assignment
in
person
.
objectValues
(
portal_type
=
"Assignment"
):
if
assignment
.
getSubordination
()
==
context
.
getRelativeUrl
():
invitation_token
.
invalidate
(
comment
=
"User already has assignment to the Person"
)
return
"Already had stuff"
person
.
newContent
(
title
=
"Assigment for Project %s"
%
context
.
getTitle
(),
portal_type
=
"Assignment"
,
destination_project_value
=
context
).
open
()
invitation_token
.
invalidate
()
return
'Go charlie'
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Project_acceptInvitation.xml
0 → 100644
View file @
925a2770
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
invitation_token=None
</string>
</value>
</item>
<item>
<key>
<string>
_proxy_roles
</string>
</key>
<value>
<tuple>
<string>
Manager
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Project_acceptInvitation
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/bt/template_path_list
View file @
925a2770
...
@@ -91,6 +91,8 @@ web_page_module/rjs_gadget_erp5_page_slap_person_revoke_certificate_html
...
@@ -91,6 +91,8 @@ web_page_module/rjs_gadget_erp5_page_slap_person_revoke_certificate_html
web_page_module/rjs_gadget_erp5_page_slap_person_revoke_certificate_js
web_page_module/rjs_gadget_erp5_page_slap_person_revoke_certificate_js
web_page_module/rjs_gadget_erp5_page_slap_person_view_html
web_page_module/rjs_gadget_erp5_page_slap_person_view_html
web_page_module/rjs_gadget_erp5_page_slap_person_view_js
web_page_module/rjs_gadget_erp5_page_slap_person_view_js
web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_html
web_page_module/rjs_gadget_erp5_page_slap_project_get_invitation_link_js
web_page_module/rjs_gadget_erp5_page_slap_project_list_html
web_page_module/rjs_gadget_erp5_page_slap_project_list_html
web_page_module/rjs_gadget_erp5_page_slap_project_list_js
web_page_module/rjs_gadget_erp5_page_slap_project_list_js
web_page_module/rjs_gadget_erp5_page_slap_project_view_html
web_page_module/rjs_gadget_erp5_page_slap_project_view_html
...
...
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