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
Eric Zheng
slapos.core
Commits
166687f7
Commit
166687f7
authored
Oct 25, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ERP5Type_getSecurityCategoryMapping into slapos_erp5
parent
b62018dc
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
92 additions
and
63 deletions
+92
-63
master/bt5/slapos_erp5/ExtensionTemplateItem/SlapOSSecurity.py
...r/bt5/slapos_erp5/ExtensionTemplateItem/SlapOSSecurity.py
+87
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getComputerSecurityCategory.xml
...kins/slapos_core/ERP5Type_getComputerSecurityCategory.xml
+1
-1
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSecurityCategoryMapping.xml
...skins/slapos_core/ERP5Type_getSecurityCategoryMapping.xml
+0
-0
master/bt5/slapos_erp5/SkinTemplateItem/portal_skins/slapos_core/ERP5Type_getSoftwareInstanceSecurityCategory.xml
...pos_core/ERP5Type_getSoftwareInstanceSecurityCategory.xml
+1
-1
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
master/bt5/slapos_erp5/bt/template_extension_id_list
master/bt5/slapos_erp5/bt/template_extension_id_list
+1
-0
master/bt5/vifib_erp5/ExtensionTemplateItem/VifibSecurity.py
master/bt5/vifib_erp5/ExtensionTemplateItem/VifibSecurity.py
+0
-59
master/bt5/vifib_erp5/bt/revision
master/bt5/vifib_erp5/bt/revision
+1
-1
No files found.
master/bt5/slapos_erp5/ExtensionTemplateItem/SlapOSSecurity.py
0 → 100644
View file @
166687f7
###############################################################################
#
# Copyright (c) 2002-2011 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
Products.ERP5Security.ERP5GroupManager
import
ConsistencyError
def
getComputerSecurityCategory
(
self
,
base_category_list
,
user_name
,
object
,
portal_type
):
"""
This script returns a list of dictionaries which represent
the security groups which a computer is member of.
"""
category_list
=
[]
computer_list
=
self
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
'Computer'
,
reference
=
user_name
,
validation_state
=
"validated"
,
limit
=
2
,
)
if
len
(
computer_list
)
==
1
:
for
base_category
in
base_category_list
:
if
base_category
==
"role"
:
category_list
.
append
(
{
base_category
:
[
'role'
,
'role/computer'
]})
elif
len
(
computer_list
)
>
1
:
raise
ConsistencyError
,
"Error: There is more than one Computer "
\
"with reference '%s'"
%
user_name
return
category_list
def
getSoftwareInstanceSecurityCategory
(
self
,
base_category_list
,
user_name
,
object
,
portal_type
):
"""
This script returns a list of dictionaries which represent
the security groups which a Software Instance is member of.
"""
category_list
=
[]
software_instance_list
=
self
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
'Software Instance'
,
reference
=
user_name
,
validation_state
=
"validated"
,
limit
=
2
,
)
if
len
(
software_instance_list
)
==
1
:
category_dict
=
{}
for
base_category
in
base_category_list
:
if
base_category
==
"role"
:
category_dict
.
setdefault
(
base_category
,
[]).
extend
([
'role'
,
'role/instance'
])
if
base_category
==
"aggregate"
:
software_instance
=
software_instance_list
[
0
]
hosting_item
=
software_instance
.
getAggregateValue
(
portal_type
=
'Hosting Subscription'
)
if
hosting_item
is
not
None
:
category_dict
.
setdefault
(
base_category
,
[]).
append
(
hosting_item
.
getRelativeUrl
())
category_list
.
append
(
category_dict
)
elif
len
(
software_instance_list
)
>
1
:
raise
ConsistencyError
,
"Error: There is more than one Software Instance "
\
"with reference %r"
%
user_name
return
category_list
master/bt5/
vifib_erp5/SkinTemplateItem/portal_skins/vifib
_core/ERP5Type_getComputerSecurityCategory.xml
→
master/bt5/
slapos_erp5/SkinTemplateItem/portal_skins/slapos
_core/ERP5Type_getComputerSecurityCategory.xml
View file @
166687f7
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_module
</string>
</key>
<key>
<string>
_module
</string>
</key>
<value>
<string>
Vifib
Security
</string>
</value>
<value>
<string>
SlapOS
Security
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/
vifib_erp5/SkinTemplateItem/portal_skins/vifib
_core/ERP5Type_getSecurityCategoryMapping.xml
→
master/bt5/
slapos_erp5/SkinTemplateItem/portal_skins/slapos
_core/ERP5Type_getSecurityCategoryMapping.xml
View file @
166687f7
File moved
master/bt5/
vifib_erp5/SkinTemplateItem/portal_skins/vifib
_core/ERP5Type_getSoftwareInstanceSecurityCategory.xml
→
master/bt5/
slapos_erp5/SkinTemplateItem/portal_skins/slapos
_core/ERP5Type_getSoftwareInstanceSecurityCategory.xml
View file @
166687f7
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_module
</string>
</key>
<key>
<string>
_module
</string>
</key>
<value>
<string>
Vifib
Security
</string>
</value>
<value>
<string>
SlapOS
Security
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
master/bt5/slapos_erp5/bt/revision
View file @
166687f7
15
16
\ No newline at end of file
\ No newline at end of file
master/bt5/slapos_erp5/bt/template_extension_id_list
0 → 100644
View file @
166687f7
SlapOSSecurity
\ No newline at end of file
master/bt5/vifib_erp5/ExtensionTemplateItem/VifibSecurity.py
View file @
166687f7
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#
#
##############################################################################
##############################################################################
from
Products.ERP5Security.ERP5GroupManager
import
ConsistencyError
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
,
newSecurityManager
setSecurityManager
,
newSecurityManager
from
AccessControl
import
Unauthorized
from
AccessControl
import
Unauthorized
...
@@ -84,61 +83,3 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
...
@@ -84,61 +83,3 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
# Restore the original user.
# Restore the original user.
setSecurityManager
(
sm
)
setSecurityManager
(
sm
)
def
getComputerSecurityCategory
(
self
,
base_category_list
,
user_name
,
object
,
portal_type
):
"""
This script returns a list of dictionaries which represent
the security groups which a computer is member of.
"""
category_list
=
[]
computer_list
=
self
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
'Computer'
,
reference
=
user_name
,
validation_state
=
"validated"
,
limit
=
2
,
)
if
len
(
computer_list
)
==
1
:
for
base_category
in
base_category_list
:
if
base_category
==
"role"
:
category_list
.
append
(
{
base_category
:
[
'role'
,
'role/computer'
]})
elif
len
(
computer_list
)
>
1
:
raise
ConsistencyError
,
"Error: There is more than one Computer "
\
"with reference '%s'"
%
user_name
return
category_list
def
getSoftwareInstanceSecurityCategory
(
self
,
base_category_list
,
user_name
,
object
,
portal_type
):
"""
This script returns a list of dictionaries which represent
the security groups which a Software Instance is member of.
"""
category_list
=
[]
software_instance_list
=
self
.
portal_catalog
.
unrestrictedSearchResults
(
portal_type
=
'Software Instance'
,
reference
=
user_name
,
validation_state
=
"validated"
,
limit
=
2
,
)
if
len
(
software_instance_list
)
==
1
:
category_dict
=
{}
for
base_category
in
base_category_list
:
if
base_category
==
"role"
:
category_dict
.
setdefault
(
base_category
,
[]).
extend
([
'role'
,
'role/instance'
])
if
base_category
==
"aggregate"
:
software_instance
=
software_instance_list
[
0
]
hosting_item
=
software_instance
.
getAggregateValue
(
portal_type
=
'Hosting Subscription'
)
if
hosting_item
is
not
None
:
category_dict
.
setdefault
(
base_category
,
[]).
append
(
hosting_item
.
getRelativeUrl
())
category_list
.
append
(
category_dict
)
elif
len
(
software_instance_list
)
>
1
:
raise
ConsistencyError
,
"Error: There is more than one Software Instance "
\
"with reference %r"
%
user_name
return
category_list
master/bt5/vifib_erp5/bt/revision
View file @
166687f7
520
521
\ No newline at end of file
\ 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