add security audit view: Workspace Assignments
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@4073 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
c2ccc9fdb5
commit
a3a44a42d8
2 changed files with 42 additions and 2 deletions
|
@ -51,8 +51,24 @@
|
||||||
|
|
||||||
<metal:macro define-macro="workspace_assignments">
|
<metal:macro define-macro="workspace_assignments">
|
||||||
<metal:headline use-macro="view/concept_macros/concepttitle" />
|
<metal:headline use-macro="view/concept_macros/concepttitle" />
|
||||||
blubb
|
<table class="listing">
|
||||||
|
<tr>
|
||||||
|
<th>Person</th>
|
||||||
|
<th class="center"
|
||||||
|
tal:repeat="ws item/workspaces">
|
||||||
|
<a tal:attributes="href python:view.getUrlForTarget(ws)"
|
||||||
|
tal:content="ws/title" /></th>
|
||||||
|
</tr>
|
||||||
|
<tr tal:repeat="person item/persons">
|
||||||
|
<td>
|
||||||
|
<a tal:attributes="href python:view.getUrlForTarget(person)"
|
||||||
|
tal:content="person/title" /></td>
|
||||||
|
<td class="center"
|
||||||
|
tal:repeat="assignment python:item.getAssignments(person)"
|
||||||
|
tal:content="assignment" />
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</metal:macro>
|
</metal:macro>
|
||||||
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -107,3 +107,27 @@ class WorkspaceAssignments(BaseSecurityView):
|
||||||
def macro(self):
|
def macro(self):
|
||||||
return self.template.macros['workspace_assignments']
|
return self.template.macros['workspace_assignments']
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def workspacePrediactes(self):
|
||||||
|
result = [self.conceptManager.get(p)
|
||||||
|
for p in ('isowner', 'ismaster', 'ismember')]
|
||||||
|
return [p for p in result if p is not None]
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def workspaces(self):
|
||||||
|
typeNames = self.options('workspace')
|
||||||
|
if typeNames:
|
||||||
|
type = self.conceptManager.get(typeNames[0])
|
||||||
|
return type.getChildren([self.typePredicate])
|
||||||
|
return []
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def persons(self):
|
||||||
|
tPerson = self.conceptManager['person']
|
||||||
|
return tPerson.getChildren([self.typePredicate])
|
||||||
|
|
||||||
|
def getAssignments(self, person):
|
||||||
|
rels = []
|
||||||
|
for ws in self.workspaces:
|
||||||
|
rels.append(ws.getChildRelations(self.workspacePrediactes, person))
|
||||||
|
return [', '.join([r.predicate.title for r in prels]) for prels in rels]
|
||||||
|
|
Loading…
Add table
Reference in a new issue