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
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
ef6f1147
Commit
ef6f1147
authored
Apr 10, 2018
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: Update utility scripts for introspect security_uids
parent
6fe46d7d
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
323 additions
and
51 deletions
+323
-51
master/bt5/slapos_erp5/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSAdministration.py
.../portal_components/extension.erp5.SlapOSAdministration.py
+36
-0
master/bt5/slapos_erp5/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSAdministration.xml
...portal_components/extension.erp5.SlapOSAdministration.xml
+123
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Base_getAllowedRolesAndUsers.xml
...ns/slapos_administration/Base_getAllowedRolesAndUsers.xml
+28
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Base_getSecurityUidDictAndRoleColumnDictForUser.xml
...ation/Base_getSecurityUidDictAndRoleColumnDictForUser.xml
+28
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.py
...nistration/ERP5Site_getSecurityUidListForRecreateTable.py
+0
-7
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.xml
...istration/ERP5Site_getSecurityUidListForRecreateTable.xml
+9
-43
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidStat.py
...kins/slapos_administration/ERP5Site_getSecurityUidStat.py
+35
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidStat.xml
...ins/slapos_administration/ERP5Site_getSecurityUidStat.xml
+62
-0
master/bt5/slapos_erp5/bt/template_extension_id_list
master/bt5/slapos_erp5/bt/template_extension_id_list
+2
-1
No files found.
master/bt5/slapos_erp5/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSAdministration.py
0 → 100644
View file @
ef6f1147
import
transaction
def
Base_getSecurityUidDictAndRoleColumnDictForUser
(
self
,
user_id
):
from
AccessControl.SecurityManagement
import
getSecurityManager
from
AccessControl.SecurityManagement
import
setSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
sm
=
getSecurityManager
()
try
:
u
=
self
.
acl_users
.
getUserById
(
user_id
)
newSecurityManager
(
None
,
u
.
__of__
(
self
.
acl_users
))
return
[
dict
(
item
)
for
item
in
self
.
portal_catalog
.
getSecurityUidDictAndRoleColumnDict
()]
finally
:
transaction
.
abort
()
# why ???
setSecurityManager
(
sm
)
def
Base_getAllowedRolesAndUsers
(
self
,
user_id
):
from
AccessControl.SecurityManagement
import
getSecurityManager
from
AccessControl.SecurityManagement
import
setSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
sm
=
getSecurityManager
()
try
:
u
=
self
.
acl_users
.
getUserById
(
user_id
)
newSecurityManager
(
None
,
u
.
__of__
(
self
.
acl_users
))
return
self
.
portal_catalog
.
getAllowedRolesAndUsers
()
finally
:
transaction
.
abort
()
# why ???
setSecurityManager
(
sm
)
def
ERP5Site_getSecurityUidListForRecreateTable
(
self
):
security_uid_entry_list
=
[]
for
item
in
self
.
getPortalObject
().
portal_catalog
.
getSQLCatalog
().
getRoleAndSecurityUidList
():
security_uid_entry_list
.
append
((
item
[
2
],
item
[
1
]))
return
security_uid_entry_list
\ No newline at end of file
master/bt5/slapos_erp5/ExtensionTemplateItem/portal_components/extension.erp5.SlapOSAdministration.xml
0 → 100644
View file @
ef6f1147
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Extension Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
SlapOSAdministration
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
extension.erp5.SlapOSAdministration
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Extension Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Base_getAllowedRolesAndUsers.xml
0 → 100644
View file @
ef6f1147
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
Base_getAllowedRolesAndUsers
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSAdministration
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getAllowedRolesAndUsers
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/Base_getSecurityUidDictAndRoleColumnDictForUser.xml
0 → 100644
View file @
ef6f1147
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_function
</string>
</key>
<value>
<string>
Base_getSecurityUidDictAndRoleColumnDictForUser
</string>
</value>
</item>
<item>
<key>
<string>
_module
</string>
</key>
<value>
<string>
SlapOSAdministration
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Base_getSecurityUidDictAndRoleColumnDictForUser
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.py
deleted
100644 → 0
View file @
6fe46d7d
security_uid_entry_list
=
[]
for
item
in
context
.
getPortalObject
().
portal_catalog
.
getSQLCatalog
().
getRoleAndSecurityUidList
():
if
isinstance
(
item
[
0
],
tuple
):
for
role
in
item
[
0
]:
security_uid_entry_list
.
append
((
item
[
1
],
role
))
return
security_uid_entry_list
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidListForRecreateTable.xml
View file @
ef6f1147
...
@@ -2,60 +2,26 @@
...
@@ -2,60 +2,26 @@
<ZopeData>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<pickle>
<global
name=
"
PythonScript"
module=
"Products.PythonScripts.PythonScript
"
/>
<global
name=
"
ExternalMethod"
module=
"Products.ExternalMethod.ExternalMethod
"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<item>
<key>
<string>
Script_magic
</string>
</key>
<key>
<string>
_function
</string>
</key>
<value>
<int>
3
</int>
</value>
<value>
<string>
ERP5Site_getSecurityUidListForRecreateTable
</string>
</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>
<item>
<item>
<key>
<string>
_
params
</string>
</key>
<key>
<string>
_
module
</string>
</key>
<value>
<string></string>
</value>
<value>
<string>
SlapOSAdministration
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_getSecurityUidListForRecreateTable
</string>
</value>
<value>
<string>
ERP5Site_getSecurityUidListForRecreateTable
</string>
</value>
</item>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
</record>
</record>
...
...
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidStat.py
0 → 100644
View file @
ef6f1147
portal
=
context
.
getPortalObject
()
uid_groups_columns_dict
=
portal
.
portal_catalog
.
getSQLCatalog
().
getSQLCatalogSecurityUidGroupsColumnsDict
()
uid_groups_columns_items
=
sorted
(
uid_groups_columns_dict
.
items
())
security_column_list
=
sorted
(
uid_groups_columns_dict
.
values
())
user_id_list
=
[
'claudie'
,
'rafael'
,
'vifib-admin'
,
'nexedi_development_service'
]
#for user in portal.person_module.searchFolder(
# reference='%',
# validation_state='validated',
# default_role_uid=portal.portal_categories.role.internal.getUid()):
# user_id_list.append(user.getReference())
info_list
=
[]
for
user_id
in
sorted
(
user_id_list
):
user
=
portal
.
acl_users
.
getUserById
(
user_id
)
if
user
is
None
:
continue
groups
=
user
.
getGroups
()
uid_dict_and_roles_column_dict
=
portal
.
Base_getSecurityUidDictAndRoleColumnDictForUser
(
user_id
)
info
=
[
user_id
,
len
(
groups
)]
for
local_roles_group_id
,
security_column
in
uid_groups_columns_items
:
info
.
append
(
len
(
uid_dict_and_roles_column_dict
[
0
].
get
(
local_roles_group_id
,[])))
info_list
.
append
(
info
)
print
','
.
join
([
'user_id'
,
'group_count'
,]
+
[
x
[
1
]
for
x
in
uid_groups_columns_items
])
for
info
in
info_list
:
print
','
.
join
([
str
(
x
)
for
x
in
info
])
response
=
portal
.
REQUEST
.
RESPONSE
response
.
setHeader
(
'Content-Disposition'
,
'attachement;filename=%s-%s.csv'
%
(
script
.
getId
(),
DateTime
().
strftime
(
'%Y%m%d'
)))
response
.
setHeader
(
'Content-Type'
,
'text/csv'
)
return
printed
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_administration/ERP5Site_getSecurityUidStat.xml
0 → 100644
View file @
ef6f1147
<?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></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
ERP5Site_getSecurityUidStat
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_erp5/bt/template_extension_id_list
View file @
ef6f1147
extension.erp5.SlapOSCheckConsistency
extension.erp5.SlapOSCheckConsistency
extension.erp5.SlapOSLoginMigration
extension.erp5.SlapOSLoginMigration
\ No newline at end of file
extension.erp5.SlapOSAdministration
\ No newline at end of file
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