Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
85c9193b
Commit
85c9193b
authored
Jun 05, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove remaining support classes for defining permissions TTW.
parent
91a1052f
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
13 additions
and
276 deletions
+13
-276
doc/CHANGES.rst
doc/CHANGES.rst
+2
-0
src/AccessControl/Role.py
src/AccessControl/Role.py
+0
-3
src/App/Permission.py
src/App/Permission.py
+4
-71
src/App/Product.py
src/App/Product.py
+1
-7
src/App/ProductRegistry.py
src/App/ProductRegistry.py
+5
-45
src/App/dtml/addPermission.dtml
src/App/dtml/addPermission.dtml
+0
-56
src/App/dtml/editPermission.dtml
src/App/dtml/editPermission.dtml
+0
-52
src/OFS/ObjectManager.py
src/OFS/ObjectManager.py
+1
-3
src/OFS/deprecated.zcml
src/OFS/deprecated.zcml
+0
-3
src/Products/OFSP/help/Zope-Permission.stx
src/Products/OFSP/help/Zope-Permission.stx
+0
-5
src/Products/OFSP/help/Zope-Permission_Add.stx
src/Products/OFSP/help/Zope-Permission_Add.stx
+0
-16
src/Products/OFSP/help/Zope-Permission_Edit.stx
src/Products/OFSP/help/Zope-Permission_Edit.stx
+0
-15
No files found.
doc/CHANGES.rst
View file @
85c9193b
...
...
@@ -11,6 +11,8 @@ Trunk (unreleased)
Restructuring
+++++++++++++
-
Remove
remaining
support
classes
for
defining
permissions
TTW
.
-
Moved
``
TaintedString
``
into
the
new
AccessControl
.
tainted
module
.
-
Moved
the
``
zExceptions
``
package
into
its
own
distribution
.
...
...
src/AccessControl/Role.py
View file @
85c9193b
...
...
@@ -594,9 +594,6 @@ class RoleManager(Base, RoleManager):
Products_permissions
=
getattr
(
Products
,
'__ac_permissions__'
,
())
for
p
in
Products_permissions
:
d
[
p
[
0
]]
=
1
for
p
in
self
.
aq_acquire
(
'_getProductRegistryData'
)(
'ac_permissions'
):
d
[
p
[
0
]]
=
1
for
p
in
self
.
ac_inherited_permissions
(
1
):
d
[
p
[
0
]]
=
1
...
...
src/App/Permission.py
View file @
85c9193b
...
...
@@ -10,19 +10,14 @@
# FOR A PARTICULAR PURPOSE
#
##############################################################################
__doc__
=
'''Zope registerable permissions
'''Zope registerable permissions
'''
$Id$'''
__version__
=
'$Revision: 1.9 $'
[
11
:
-
2
]
from
AccessControl.Permissions
import
view_management_screens
from
AccessControl.Permissions
import
define_permissions
from
AccessControl.Role
import
RoleManager
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
Acquisition
import
Implicit
from
App.class_init
import
InitializeClass
from
App.special_dtml
import
DTMLFile
from
ExtensionClass
import
Base
from
OFS.SimpleItem
import
Item
from
Persistence
import
Persistent
...
...
@@ -35,14 +30,11 @@ class Permission(RoleManager,
"""
meta_type
=
'Zope Permission'
icon
=
'p_/Permission_icon'
index_html
=
None
security
=
ClassSecurityInfo
()
manage_options
=
(
(
{
'label'
:
'Edit'
,
'action'
:
'manage_main'
,
'help'
:(
'OFSP'
,
'Zope-Permission_Edit.stx'
)},
)
+
RoleManager
.
manage_options
RoleManager
.
manage_options
+
Item
.
manage_options
)
...
...
@@ -51,63 +43,4 @@ class Permission(RoleManager,
self
.
title
=
title
self
.
name
=
name
security
.
declareProtected
(
define_permissions
,
'manage_edit'
)
def
manage_edit
(
self
,
title
,
name
,
REQUEST
=
None
):
"Modify Permission properties."
if
title
!=
self
.
title
:
self
.
title
=
title
if
name
!=
self
.
name
:
self
.
_unregister
()
self
.
name
=
name
self
.
_register
()
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
)
security
.
declarePrivate
(
'manage_afterAdd'
)
def
manage_afterAdd
(
self
,
item
,
container
):
self
.
_register
()
security
.
declarePrivate
(
'manage_beforeDelete'
)
def
manage_beforeDelete
(
self
,
item
,
container
):
self
.
_unregister
()
def
_register
(
self
):
# Register with the product folder
product
=
self
.
aq_parent
product
.
aq_acquire
(
'_manage_add_product_permission'
)(
product
,
self
.
name
)
def
_unregister
(
self
):
# Unregister with the product folder
product
=
self
.
aq_parent
product
.
aq_acquire
(
'_manage_remove_product_permission'
)(
product
,
self
.
name
)
security
.
declareProtected
(
view_management_screens
,
'manage_main'
)
manage_main
=
DTMLFile
(
'dtml/editPermission'
,
globals
())
index_html
=
None
InitializeClass
(
Permission
)
class
PermissionManager
(
Base
):
security
=
ClassSecurityInfo
()
meta_types
=
{
'name'
:
Permission
.
meta_type
,
'action'
:
'manage_addPermissionForm'
},
security
.
declareProtected
(
define_permissions
,
'manage_addPermissionForm'
)
manage_addPermissionForm
=
DTMLFile
(
'dtml/addPermission'
,
globals
())
security
.
declareProtected
(
define_permissions
,
'manage_addPermission'
)
def
manage_addPermission
(
self
,
id
,
title
,
permission
,
REQUEST
=
None
):
""" Add a TTW permission.
"""
i
=
Permission
(
id
,
title
,
permission
)
self
.
_setObject
(
id
,
i
)
if
REQUEST
is
not
None
:
return
self
.
manage_main
(
self
,
REQUEST
,
update_menu
=
1
)
InitializeClass
(
PermissionManager
)
src/App/Product.py
View file @
85c9193b
...
...
@@ -45,8 +45,6 @@ from App.class_init import InitializeClass
from
App.special_dtml
import
DTMLFile
from
OFS.Folder
import
Folder
from
App.Permission
import
PermissionManager
class
ProductFolder
(
Folder
):
"Manage a collection of Products"
...
...
@@ -71,7 +69,7 @@ class ProductFolder(Folder):
InitializeClass
(
ProductFolder
)
class
Product
(
Folder
,
PermissionManager
):
class
Product
(
Folder
):
"""Model a product that can be created through the web.
"""
...
...
@@ -83,10 +81,6 @@ class Product(Folder, PermissionManager):
configurable_objects_
=
()
import_error_
=
None
meta_types
=
(
PermissionManager
.
meta_types
)
manage_options
=
(
(
Folder
.
manage_options
[
0
],)
+
tuple
(
Folder
.
manage_options
[
2
:])
...
...
src/App/ProductRegistry.py
View file @
85c9193b
...
...
@@ -21,8 +21,6 @@
# will return:
# ....what?
from
OFS.Folder
import
Folder
class
ProductRegistryMixin
:
# This class implements a protocol for registering products that
# are defined through the web.
...
...
@@ -73,44 +71,6 @@ class ProductRegistryMixin:
self
.
_setProductRegistryMetaTypes
(
meta_types
+
(
mt
,))
def
_manage_remove_product_permission
(
self
,
product
,
permission
=
None
):
r
=
[]
r2
=
[]
pid
=
product
.
id
for
d
in
self
.
_getProductRegistryData
(
'permissions'
):
if
d
.
has_key
(
'product'
):
if
d
[
'product'
]
==
pid
and
(
permission
is
None
or
permission
==
d
[
'name'
]):
continue
elif
permission
==
d
[
'name'
]:
continue
r
.
append
(
d
)
r2
.
append
((
d
[
'name'
],
d
[
'methods'
],
d
[
'default'
]))
self
.
_setProductRegistryData
(
'permissions'
,
tuple
(
r
))
self
.
_setProductRegistryData
(
'ac_permissions'
,
tuple
(
r2
))
def
_manage_add_product_permission
(
self
,
product
,
permission
,
methods
=
(),
default
=
(
'Manager'
,)
):
permissions
=
self
.
_getProductRegistryData
(
'permissions'
)
for
d
in
permissions
:
if
d
[
'name'
]
==
permission
:
raise
ValueError
,
(
'The permission <em>%s</em> is already defined.'
%
permission
)
d
=
{
'name'
:
permission
,
'methods'
:
methods
,
'permission'
:
permission
,
'default'
:
default
,
'product'
:
product
.
id
}
self
.
_setProductRegistryData
(
'permissions'
,
permissions
+
(
d
,))
self
.
_setProductRegistryData
(
'ac_permissions'
,
self
.
_getProductRegistryData
(
'ac_permissions'
)
+
((
d
[
'name'
],
d
[
'methods'
],
d
[
'default'
]),)
)
# HACK - sometimes an unwrapped App object seems to be passed as
# self to these methods, which means that they dont have an aq_aquire
# method. Until Jim has time to look into this, this aq_maybe method
...
...
@@ -143,7 +103,6 @@ class ProductRegistryMixin:
self
.
aq_maybe
(
'_setProductRegistryData'
)(
type
,
tuple
(
values
))
class
ProductRegistry
(
ProductRegistryMixin
):
# This class implements a protocol for registering products that
# are defined through the web. It also provides methods for
...
...
@@ -154,11 +113,12 @@ class ProductRegistry(ProductRegistryMixin):
def
_getProducts
(
self
):
return
self
.
Control_Panel
.
Products
_product_meta_types
=
()
_product_permissions
=
()
_product_ac_permissions
=
()
def
_getProductRegistryMetaTypes
(
self
):
return
self
.
_product_meta_types
def
_setProductRegistryMetaTypes
(
self
,
v
):
self
.
_product_meta_types
=
v
def
_getProductRegistryMetaTypes
(
self
):
return
self
.
_product_meta_types
def
_setProductRegistryMetaTypes
(
self
,
v
):
self
.
_product_meta_types
=
v
def
_getProductRegistryData
(
self
,
name
):
return
getattr
(
self
,
'_product_%s'
%
name
)
...
...
src/App/dtml/addPermission.dtml
deleted
100644 → 0
View file @
91a1052f
<dtml-var manage_page_header>
<dtml-var "manage_form_title(this(), _,
form_title='Add Permission',
help_product='OFSP',
help_topic='Zope-Permission_Add.stx'
)">
<form action="manage_addPermission" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Name
</div>
</td>
<td align="left" valign="top">
<input type="text" name="permission" size="40" />
</td>
</tr>
<tr>
<td></td>
<td align="left" valign="top">
<div class="form-element">
<br />
<input type="submit" name="submit" value="Generate" />
</div>
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
src/App/dtml/editPermission.dtml
deleted
100644 → 0
View file @
91a1052f
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<form action="manage_edit" method="POST">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<div class="form-text">
&dtml-id;
</div>
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-optional">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title"size="40" value="&dtml-title;" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Name
</div>
</td>
<td align="left" valign="top">
<input type="text" name="name" size="40" value="&dtml-name;" />
</td>
</tr>
<tr>
<td></td>
<td>
<div class="form-element">
<input type="submit" name="submit" value="Save Changes">
</div>
</td>
</tr>
</table>
</form>
<dtml-var manage_page_footer>
src/OFS/ObjectManager.py
View file @
85c9193b
...
...
@@ -265,9 +265,7 @@ class ObjectManager(CopyContainer,
def
_subobject_permissions
(
self
):
import
Products
Products_permissions
=
getattr
(
Products
,
'__ac_permissions__'
,
())
return
(
Products_permissions
+
self
.
aq_acquire
(
'_getProductRegistryData'
)(
'ac_permissions'
)
)
return
Products_permissions
def
filtered_meta_types
(
self
,
user
=
None
):
# Return a list of the types for which the user has
...
...
src/OFS/deprecated.zcml
View file @
85c9193b
...
...
@@ -6,9 +6,6 @@
<five:deprecatedManageAddDelete
class="AccessControl.User.BasicUserFolder"/>
<five:deprecatedManageAddDelete
class="App.Permission.Permission"/>
<five:deprecatedManageAddDelete
class="HelpSys.HelpTopic.HelpTopicBase"/>
...
...
src/Products/OFSP/help/Zope-Permission.stx
deleted
100644 → 0
View file @
91a1052f
Zope Permission: Define new Permissions.
Description
Zope Permissions allow you to define new permissions.
src/Products/OFSP/help/Zope-Permission_Add.stx
deleted
100644 → 0
View file @
91a1052f
Zope Permission - Add: Create a new Permission.
Description
This view allows you to create a new Permission.
Controls
'Id' -- The id of the Zope Permission.
'Title' -- The optional title of the Zope Permission.
'Name' -- Allows you to specify the name of the permission.
**Note: A permission's name must be unique.**
'Add' -- Create a Permission.
src/Products/OFSP/help/Zope-Permission_Edit.stx
deleted
100644 → 0
View file @
91a1052f
Zope Permission - Edit: Edit Permission.
Description
This view allows you to edit Zope Permission settings.
Controls
'Title' -- The optional title of the Zope Permission.
'Name' -- The name of the permission.
**Note: A permission's name must be unique.**
'Change' -- Change the Permission.
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