Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
Zope
Commits
12d89cad
Commit
12d89cad
authored
14 years ago
by
Browse files
Options
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
from
AccessControl.Permissions
import
add_documents_images_and_files
from
AccessControl.Permissions
import
view
as
View
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityManagement
import
getSecurityManager
from
Acquisition
import
Implicit
from
App.special_dtml
import
DTMLFile
from
App.special_dtml
import
HTML
...
...
@@ -24,12 +25,12 @@ from OFS.ObjectManager import ObjectManager
from
OFS.SimpleItem
import
Item
from
Persistence
import
Persistent
from
Products.PluginIndexes.KeywordIndex.KeywordIndex
import
KeywordIndex
from
Products.ZCatalog.ZCatalog
import
ZCatalog
from
Products.ZCatalog.Lazy
import
LazyCat
from
Products.ZCTextIndex.OkapiIndex
import
OkapiIndex
from
Products.ZCTextIndex.Lexicon
import
CaseNormalizer
from
Products.ZCatalog.ZCatalog
import
ZCatalog
from
Products.ZCTextIndex.HTMLSplitter
import
HTMLWordSplitter
from
Products.ZCTextIndex.Lexicon
import
CaseNormalizer
from
Products.ZCTextIndex.Lexicon
import
StopWordRemover
from
Products.ZCTextIndex.OkapiIndex
import
OkapiIndex
from
Products.ZCTextIndex.ZCTextIndex
import
PLexicon
from
Products.ZCTextIndex.ZCTextIndex
import
ZCTextIndex
...
...
@@ -72,13 +73,13 @@ class HelpSys(Implicit, ObjectManager, Item, Persistent):
def
__call__
(
self
,
REQUEST
=
None
,
**
kw
):
"Searchable interface"
if
REQUEST
is
not
None
:
perms
=
[]
user
=
REQUEST
.
AUTHENTICATED_USER
for
p
in
self
.
ac_inherited_permissions
():
if
user
.
has_p
ermission
(
p
[
0
],
self
):
perms
=
[]
sm
=
getSecurityManager
()
for
p
in
self
.
ac_inherited_permissions
(
all
=
True
):
if
sm
.
checkP
ermission
(
p
[
0
],
self
):
perms
.
append
(
p
[
0
])
REQUEST
.
set
(
'permissions'
,
perms
)
results
=
[]
REQUEST
.
set
(
'permissions'
,
perms
)
results
=
[]
for
ph
in
self
.
helpValues
():
results
.
append
(
apply
(
getattr
(
ph
,
'__call__'
),
(
REQUEST
,)
,
kw
))
return
LazyCat
(
results
)
...
...
@@ -268,11 +269,9 @@ class ProductHelp(Implicit, ObjectManager, Item, Persistent):
Help Topics for which the user is not authorized
are not listed.
"""
topics
=
self
.
objectValues
(
'Help Topic'
)
if
REQUEST
is
None
:
return
topics
return
filter
(
lambda
ht
,
u
=
REQUEST
.
AUTHENTICATED_USER
:
ht
.
authorized
(
u
),
topics
)
topics
=
self
.
objectValues
(
'Help Topic'
)
sm
=
getSecurityManager
()
return
[
t
for
t
in
topics
if
t
.
authorized
(
sm
)
]
def
tpValues
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
src/HelpSys/HelpTopic.py
View file @
12d89cad
...
...
@@ -58,14 +58,11 @@ class HelpTopicBase:
def
helpValues
(
self
,
REQUEST
=
None
):
return
()
def
authorized
(
self
,
user
):
def
authorized
(
self
,
sm
):
"Is a given user authorized to view this Help Topic?"
if
not
self
.
permissions
:
return
1
for
perm
in
self
.
permissions
:
if
user
.
has_permission
(
perm
,
self
):
return
1
return
0
return
True
return
any
(
sm
.
checkPermission
(
p
,
self
)
for
p
in
self
.
permissions
)
# Indexable methods
# -----------------
...
...
This diff is collapsed.
Click to expand it.
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