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
Carlos Ramos Carreño
slapos.core
Commits
cf57decd
Commit
cf57decd
authored
Aug 03, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_jio: Person dont directly revoke
revoke occur directly on the Certificate Login
parent
f5dd3045
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
111 deletions
+30
-111
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getCredentialToken.py
...al_skins/slapos_hal_json_style/Base_getCredentialToken.py
+0
-6
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_getCertificate.py
...rtal_skins/slapos_hal_json_style/Person_getCertificate.py
+1
-1
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_revokeCertificate.py
...l_skins/slapos_hal_json_style/Person_revokeCertificate.py
+0
-18
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_revokeCertificate.xml
..._skins/slapos_hal_json_style/Person_revokeCertificate.xml
+0
-62
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+29
-24
No files found.
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Base_getCredentialToken.py
View file @
cf57decd
...
@@ -3,12 +3,6 @@ import json
...
@@ -3,12 +3,6 @@ import json
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
# Revoke user certificate
try
:
person
.
revokeCertificate
()
except
ValueError
:
pass
web_site
=
context
.
getWebSiteValue
()
web_site
=
context
.
getWebSiteValue
()
request_url
=
"%s/%s"
%
(
request_url
=
"%s/%s"
%
(
web_site
.
getLayoutProperty
(
web_site
.
getLayoutProperty
(
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_getCertificate.py
View file @
cf57decd
...
@@ -11,7 +11,7 @@ if person is None:
...
@@ -11,7 +11,7 @@ if person is None:
return
{}
return
{}
try
:
try
:
return
json
.
dumps
(
person
.
ge
t
Certificate
())
return
json
.
dumps
(
person
.
ge
nerate
Certificate
())
# Certificate is Created
# Certificate is Created
except
ValueError
:
except
ValueError
:
# Certificate was already requested, please revoke existing one.
# Certificate was already requested, please revoke existing one.
...
...
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_revokeCertificate.py
deleted
100644 → 0
View file @
f5dd3045
""" This script is required due the ValueError, should be more HTTP friendly.
"""
portal
=
context
.
getPortalObject
()
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
request
=
context
.
REQUEST
response
=
request
.
RESPONSE
import
json
if
person
is
None
:
response
.
setStatus
(
403
)
else
:
try
:
person
.
revokeCertificate
()
return
json
.
dumps
(
True
)
except
ValueError
:
return
json
.
dumps
(
False
)
master/bt5/slapos_jio/SkinTemplateItem/portal_skins/slapos_hal_json_style/Person_revokeCertificate.xml
deleted
100644 → 0
View file @
f5dd3045
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"_reconstructor"
module=
"copy_reg"
/>
</klass>
<tuple>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
<global
name=
"object"
module=
"__builtin__"
/>
<none/>
</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>
*args, **kwargs
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Person_revokeCertificate
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
cf57decd
...
@@ -727,7 +727,7 @@ class TestPerson_newLogin(TestSlapOSHalJsonStyleMixin):
...
@@ -727,7 +727,7 @@ class TestPerson_newLogin(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
self
.
assertIn
(
person
.
getRelativeUrl
(),
result
)
self
.
assertIn
(
person
.
getRelativeUrl
(),
result
)
class
TestPerson_get_
revoke_
Certificate
(
TestSlapOSHalJsonStyleMixin
):
class
TestPerson_get_Certificate
(
TestSlapOSHalJsonStyleMixin
):
def
test_Person_getCertificate_unauthorized
(
self
):
def
test_Person_getCertificate_unauthorized
(
self
):
person
=
self
.
_makePerson
(
user
=
1
)
person
=
self
.
_makePerson
(
user
=
1
)
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
...
@@ -735,38 +735,43 @@ class TestPerson_get_revoke_Certificate(TestSlapOSHalJsonStyleMixin):
...
@@ -735,38 +735,43 @@ class TestPerson_get_revoke_Certificate(TestSlapOSHalJsonStyleMixin):
self
.
assertEqual
(
person
.
Person_getCertificate
(),
{})
self
.
assertEqual
(
person
.
Person_getCertificate
(),
{})
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
403
)
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
403
)
def
test_Person_
revokeCertificate_unauthorized
(
self
):
def
test_Person_
get_Certificate
(
self
):
person
=
self
.
_makePerson
(
user
=
1
)
person
=
self
.
_makePerson
(
user
=
1
)
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
self
.
assertEqual
(
person
.
Person_revokeCertificate
(),
None
)
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
403
)
def
test_Person_get_revoke_Certificate
(
self
):
person
=
self
.
_makePerson
(
user
=
1
)
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"ERP5 Login"
)))
self
.
login
(
person
.
getUserId
())
self
.
login
(
person
.
getUserId
())
response_dict
=
json
.
loads
(
person
.
Person_getCertificate
())
response_dict
=
json
.
loads
(
person
.
Person_getCertificate
())
self
.
assertEqual
(
1
,
len
(
person
.
objectValues
(
portal_type
=
"Certificate Login"
)))
self
.
assertSameSet
(
response_dict
.
keys
(),
[
"common_name"
,
"certificate"
,
"id"
,
"key"
])
login
=
person
.
objectValues
(
portal_type
=
"Certificate Login"
)[
0
]
self
.
assertEqual
(
response_dict
[
"common_name"
],
person
.
getUserId
())
self
.
assertEqual
(
"validated"
,
login
.
getValidationState
())
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
response_false
=
json
.
loads
(
person
.
Person_getCertificate
())
self
.
assertSameSet
(
response_dict
.
keys
(),
[
"common_name"
,
"certificate"
,
"id"
,
"key"
])
self
.
assertFalse
(
response_false
)
response_true
=
json
.
loads
(
person
.
Person_revokeCertificate
())
self
.
assertEqual
(
response_dict
[
"id"
],
login
.
getDestinationReference
())
self
.
assertTrue
(
response_true
)
self
.
assertEqual
(
response_dict
[
"common_name"
],
login
.
getReference
())
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
response_false
=
json
.
loads
(
person
.
Person_revoke
Certificate
())
new_response_dict
=
json
.
loads
(
person
.
Person_get
Certificate
())
self
.
assert
False
(
response_false
)
self
.
assert
True
(
new_response_dict
)
response_dict
=
json
.
loads
(
person
.
Person_getCertificate
())
self
.
assertEqual
(
2
,
len
(
person
.
objectValues
(
portal_type
=
"Certificate Login"
)))
new_login
=
[
i
for
i
in
person
.
objectValues
(
portal_type
=
"Certificate Login"
)
if
i
.
getUid
()
!=
login
.
getUid
()][
0
]
self
.
assertEqual
(
"validated"
,
login
.
getValidationState
())
self
.
assertEqual
(
"validated"
,
new_login
.
getValidationState
())
self
.
assertNotEqual
(
login
.
getReference
(),
new_login
.
getReference
())
self
.
assertNotEqual
(
login
.
getDestinationReference
(),
new_login
.
getDestinationReference
())
self
.
assertSameSet
(
new_response_dict
.
keys
(),
[
"common_name"
,
"certificate"
,
"id"
,
"key"
])
self
.
assertEqual
(
new_response_dict
[
"common_name"
],
new_login
.
getReference
())
self
.
assertEqual
(
new_response_dict
[
"id"
],
new_login
.
getDestinationReference
())
self
.
assertNotEqual
(
new_response_dict
[
"common_name"
],
response_dict
[
"common_name"
])
self
.
assertNotEqual
(
new_response_dict
[
"id"
],
response_dict
[
"id"
])
self
.
assertNotEqual
(
new_response_dict
[
"key"
],
response_dict
[
"key"
])
self
.
assertNotEqual
(
new_response_dict
[
"certificate"
],
response_dict
[
"certificate"
])
self
.
assertSameSet
(
response_dict
.
keys
(),
[
"common_name"
,
"certificate"
,
"id"
,
"key"
])
self
.
assertEqual
(
response_dict
[
"common_name"
],
person
.
getUserId
())
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
self
.
assertEqual
(
self
.
portal
.
REQUEST
.
RESPONSE
.
getStatus
(),
200
)
class
TestPerson_testLoginExistence
(
TestSlapOSHalJsonStyleMixin
):
class
TestPerson_testLoginExistence
(
TestSlapOSHalJsonStyleMixin
):
...
...
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