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
12d89cad
Commit
12d89cad
authored
Dec 28, 2010
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed some permission checks
parent
88ea35a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
20 deletions
+16
-20
src/HelpSys/HelpSys.py
src/HelpSys/HelpSys.py
+13
-14
src/HelpSys/HelpTopic.py
src/HelpSys/HelpTopic.py
+3
-6
No files found.
src/HelpSys/HelpSys.py
View file @
12d89cad
...
@@ -17,6 +17,7 @@ from AccessControl.Permissions import access_contents_information
...
@@ -17,6 +17,7 @@ from AccessControl.Permissions import access_contents_information
from
AccessControl.Permissions
import
add_documents_images_and_files
from
AccessControl.Permissions
import
add_documents_images_and_files
from
AccessControl.Permissions
import
view
as
View
from
AccessControl.Permissions
import
view
as
View
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityManagement
import
getSecurityManager
from
Acquisition
import
Implicit
from
Acquisition
import
Implicit
from
App.special_dtml
import
DTMLFile
from
App.special_dtml
import
DTMLFile
from
App.special_dtml
import
HTML
from
App.special_dtml
import
HTML
...
@@ -24,12 +25,12 @@ from OFS.ObjectManager import ObjectManager
...
@@ -24,12 +25,12 @@ from OFS.ObjectManager import ObjectManager
from
OFS.SimpleItem
import
Item
from
OFS.SimpleItem
import
Item
from
Persistence
import
Persistent
from
Persistence
import
Persistent
from
Products.PluginIndexes.KeywordIndex.KeywordIndex
import
KeywordIndex
from
Products.PluginIndexes.KeywordIndex.KeywordIndex
import
KeywordIndex
from
Products.ZCatalog.ZCatalog
import
ZCatalog
from
Products.ZCatalog.Lazy
import
LazyCat
from
Products.ZCatalog.Lazy
import
LazyCat
from
Products.ZCTextIndex.OkapiIndex
import
OkapiIndex
from
Products.ZCatalog.ZCatalog
import
ZCatalog
from
Products.ZCTextIndex.Lexicon
import
CaseNormalizer
from
Products.ZCTextIndex.HTMLSplitter
import
HTMLWordSplitter
from
Products.ZCTextIndex.HTMLSplitter
import
HTMLWordSplitter
from
Products.ZCTextIndex.Lexicon
import
CaseNormalizer
from
Products.ZCTextIndex.Lexicon
import
StopWordRemover
from
Products.ZCTextIndex.Lexicon
import
StopWordRemover
from
Products.ZCTextIndex.OkapiIndex
import
OkapiIndex
from
Products.ZCTextIndex.ZCTextIndex
import
PLexicon
from
Products.ZCTextIndex.ZCTextIndex
import
PLexicon
from
Products.ZCTextIndex.ZCTextIndex
import
ZCTextIndex
from
Products.ZCTextIndex.ZCTextIndex
import
ZCTextIndex
...
@@ -72,13 +73,13 @@ class HelpSys(Implicit, ObjectManager, Item, Persistent):
...
@@ -72,13 +73,13 @@ class HelpSys(Implicit, ObjectManager, Item, Persistent):
def
__call__
(
self
,
REQUEST
=
None
,
**
kw
):
def
__call__
(
self
,
REQUEST
=
None
,
**
kw
):
"Searchable interface"
"Searchable interface"
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
perms
=
[]
perms
=
[]
user
=
REQUEST
.
AUTHENTICATED_USER
sm
=
getSecurityManager
()
for
p
in
self
.
ac_inherited_permissions
():
for
p
in
self
.
ac_inherited_permissions
(
all
=
True
):
if
user
.
has_p
ermission
(
p
[
0
],
self
):
if
sm
.
checkP
ermission
(
p
[
0
],
self
):
perms
.
append
(
p
[
0
])
perms
.
append
(
p
[
0
])
REQUEST
.
set
(
'permissions'
,
perms
)
REQUEST
.
set
(
'permissions'
,
perms
)
results
=
[]
results
=
[]
for
ph
in
self
.
helpValues
():
for
ph
in
self
.
helpValues
():
results
.
append
(
apply
(
getattr
(
ph
,
'__call__'
),
(
REQUEST
,)
,
kw
))
results
.
append
(
apply
(
getattr
(
ph
,
'__call__'
),
(
REQUEST
,)
,
kw
))
return
LazyCat
(
results
)
return
LazyCat
(
results
)
...
@@ -268,11 +269,9 @@ class ProductHelp(Implicit, ObjectManager, Item, Persistent):
...
@@ -268,11 +269,9 @@ class ProductHelp(Implicit, ObjectManager, Item, Persistent):
Help Topics for which the user is not authorized
Help Topics for which the user is not authorized
are not listed.
are not listed.
"""
"""
topics
=
self
.
objectValues
(
'Help Topic'
)
topics
=
self
.
objectValues
(
'Help Topic'
)
if
REQUEST
is
None
:
sm
=
getSecurityManager
()
return
topics
return
[
t
for
t
in
topics
if
t
.
authorized
(
sm
)
]
return
filter
(
lambda
ht
,
u
=
REQUEST
.
AUTHENTICATED_USER
:
ht
.
authorized
(
u
),
topics
)
def
tpValues
(
self
):
def
tpValues
(
self
):
"""
"""
...
...
src/HelpSys/HelpTopic.py
View file @
12d89cad
...
@@ -58,14 +58,11 @@ class HelpTopicBase:
...
@@ -58,14 +58,11 @@ class HelpTopicBase:
def
helpValues
(
self
,
REQUEST
=
None
):
def
helpValues
(
self
,
REQUEST
=
None
):
return
()
return
()
def
authorized
(
self
,
user
):
def
authorized
(
self
,
sm
):
"Is a given user authorized to view this Help Topic?"
"Is a given user authorized to view this Help Topic?"
if
not
self
.
permissions
:
if
not
self
.
permissions
:
return
1
return
True
for
perm
in
self
.
permissions
:
return
any
(
sm
.
checkPermission
(
p
,
self
)
for
p
in
self
.
permissions
)
if
user
.
has_permission
(
perm
,
self
):
return
1
return
0
# Indexable methods
# Indexable methods
# -----------------
# -----------------
...
...
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