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
65dd4bef
Commit
65dd4bef
authored
Nov 06, 1997
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added global roles to app
parent
b716acba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
14 deletions
+32
-14
lib/python/AccessControl/Role.py
lib/python/AccessControl/Role.py
+13
-7
lib/python/OFS/Application.py
lib/python/OFS/Application.py
+19
-7
No files found.
lib/python/AccessControl/Role.py
View file @
65dd4bef
"""Access control package"""
"""Access control package"""
__version__
=
'$Revision: 1.
3
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
import
Globals
import
Globals
from
User
import
SafeDtml
from
User
import
SafeDtml
...
@@ -15,7 +15,7 @@ class RoleManager:
...
@@ -15,7 +15,7 @@ class RoleManager:
smallRolesWidget
=
SafeDtml
(
'AccessControl/smallRolesWidget'
)
smallRolesWidget
=
SafeDtml
(
'AccessControl/smallRolesWidget'
)
def
validRoles
(
self
):
def
validRoles
(
self
):
return
Globals
.
Bobobase
[
'
roles'
]
return
Globals
.
Bobobase
[
'
Application'
].
__defined_roles__
def
selectedRoles
(
self
):
def
selectedRoles
(
self
):
try
:
roles
=
self
.
__roles__
try
:
roles
=
self
.
__roles__
...
@@ -76,9 +76,12 @@ class RoleManager:
...
@@ -76,9 +76,12 @@ class RoleManager:
def
manage_addRole
(
self
,
REQUEST
,
role
):
def
manage_addRole
(
self
,
REQUEST
,
role
):
""" """
""" """
roles
=
Globals
.
Bobobase
[
'roles'
]
app
=
Globals
.
Bobobase
[
'Application'
]
roles
=
list
(
app
.
__defined_roles__
)
if
role
not
in
roles
:
if
role
not
in
roles
:
Globals
.
Bobobase
[
'roles'
]
=
tuple
(
roles
)
+
(
role
,)
roles
.
append
(
role
)
roles
.
sort
()
app
.
__defined_roles__
=
tuple
(
roles
)
try
:
roles
=
self
.
__roles__
try
:
roles
=
self
.
__roles__
except
:
roles
=
[]
except
:
roles
=
[]
if
roles
is
None
:
roles
=
[]
if
roles
is
None
:
roles
=
[]
...
@@ -88,11 +91,11 @@ class RoleManager:
...
@@ -88,11 +91,11 @@ class RoleManager:
def
manage_deleteRole
(
self
,
REQUEST
,
role
):
def
manage_deleteRole
(
self
,
REQUEST
,
role
):
""" """
""" """
roles
=
Globals
.
Bobobase
[
'roles'
]
app
=
Globals
.
Bobobase
[
'Application'
]
roles
=
list
(
app
.
__defined_roles__
)
if
role
in
roles
:
if
role
in
roles
:
roles
=
list
(
roles
)
del
roles
[
roles
.
index
(
role
)]
del
roles
[
roles
.
index
(
role
)]
Globals
.
Bobobase
[
'roles'
]
=
tuple
(
roles
)
app
.
__defined_roles__
=
tuple
(
roles
)
return
self
.
manage_main
(
self
,
REQUEST
)
return
self
.
manage_main
(
self
,
REQUEST
)
def
_setRoles
(
self
,
acl_type
,
acl_roles
):
def
_setRoles
(
self
,
acl_type
,
acl_roles
):
...
@@ -110,6 +113,9 @@ class RoleManager:
...
@@ -110,6 +113,9 @@ class RoleManager:
# $Log: Role.py,v $
# $Log: Role.py,v $
# Revision 1.4 1997/11/06 22:45:26 brian
# Added global roles to app
#
# Revision 1.3 1997/09/08 23:01:33 brian
# Revision 1.3 1997/09/08 23:01:33 brian
# Style mods
# Style mods
#
#
...
...
lib/python/OFS/Application.py
View file @
65dd4bef
...
@@ -11,8 +11,8 @@
...
@@ -11,8 +11,8 @@
__doc__
=
'''Application support
__doc__
=
'''Application support
$Id: Application.py,v 1.1
6 1997/11/05 15:06:56 paul
Exp $'''
$Id: Application.py,v 1.1
7 1997/11/06 22:43:39 brian
Exp $'''
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
7
$'
[
11
:
-
2
]
import
Globals
,
Folder
,
regex
import
Globals
,
Folder
,
regex
...
@@ -25,6 +25,7 @@ class Application(Folder.Folder):
...
@@ -25,6 +25,7 @@ class Application(Folder.Folder):
title
=
'Principia'
title
=
'Principia'
id
=
title
id
=
title
__roles__
=
None
__roles__
=
None
__defined_roles__
=
(
'manage'
,)
web__form__method
=
'GET'
web__form__method
=
'GET'
manage_options
=
(
manage_options
=
(
...
@@ -97,8 +98,9 @@ def install_products(products):
...
@@ -97,8 +98,9 @@ def install_products(products):
# Install a list of products into the basic folder class, so
# Install a list of products into the basic folder class, so
# that all folders know about top-level objects, aka products
# that all folders know about top-level objects, aka products
app
=
Globals
.
Bobobase
[
'Application'
]
meta_types
=
list
(
Folder
.
Folder
.
dynamic_meta_types
)
meta_types
=
list
(
Folder
.
Folder
.
dynamic_meta_types
)
role_names
=
list
(
Globals
.
Bobobase
[
'roles'
]
)
role_names
=
list
(
app
.
__defined_roles__
)
for
product
in
products
:
for
product
in
products
:
product
=
__import__
(
product
)
product
=
__import__
(
product
)
...
@@ -143,16 +145,23 @@ def install_products(products):
...
@@ -143,16 +145,23 @@ def install_products(products):
for
name
,
method
in
product
.
methods
.
items
():
for
name
,
method
in
product
.
methods
.
items
():
setattr
(
Folder
.
Folder
,
name
,
method
)
setattr
(
Folder
.
Folder
,
name
,
method
)
# Try to install role names
# Try to install role names
try
:
try
:
for
n
in
product
.
role_names
:
for
n
in
product
.
role_names
:
if
n
not
in
role_names
:
role_names
.
append
(
n
)
if
n
not
in
role_names
:
role_names
.
append
(
n
)
except
:
pass
except
:
pass
Folder
.
Folder
.
dynamic_meta_types
=
tuple
(
meta_types
)
Folder
.
Folder
.
dynamic_meta_types
=
tuple
(
meta_types
)
role_names
.
sort
()
role_names
=
tuple
(
role_names
)
role_names
=
tuple
(
role_names
)
if
Globals
.
Bobobase
[
'roles'
]
!=
role_names
:
if
app
.
__defined_roles__
!=
role_names
:
Globals
.
Bobobase
[
'roles'
]
=
role_names
app
.
__defined_roles__
=
tuple
(
role_names
)
# if Globals.Bobobase['roles'] != role_names:
# Globals.Bobobase['roles'] = role_names
...
@@ -171,6 +180,9 @@ if __name__ == "__main__": main()
...
@@ -171,6 +180,9 @@ if __name__ == "__main__": main()
##############################################################################
##############################################################################
#
#
# $Log: Application.py,v $
# $Log: Application.py,v $
# Revision 1.17 1997/11/06 22:43:39 brian
# Added global roles to app
#
# Revision 1.16 1997/11/05 15:06:56 paul
# Revision 1.16 1997/11/05 15:06:56 paul
# Renamed Redirect to PrincipiaRedirect, leaving Redirect for
# Renamed Redirect to PrincipiaRedirect, leaving Redirect for
# compatibility. Added PrincipiaTime which returns a DateTime object.
# compatibility. Added PrincipiaTime which returns a DateTime object.
...
...
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