Beispiel #1
0
 def can_purge(self, username):
     username = self.applyTransform(username)
     if not self.adapts_project:
         return False  # no purge in workspace other than top-level project
     if username not in self.keys():
         return False  # sanity check, username must be in project roster
     # if a user is in this project's roster, but in more than
     # one (this) project, do not allow purge:
     return 1 == len(user_workspaces(username, finder=get_projects))
 def can_purge(self, username):
     username = self.applyTransform(username)
     if not self.adapts_project:
         return False  # no purge in workspace other than top-level project
     if username not in self.keys():
         return False  # sanity check, username must be in project roster
     # if a user is in this project's roster, but in more than
     # one (this) project, do not allow purge:
     return 1 == len(user_workspaces(username, finder=get_projects))
 def linked_workspaces(self, username):
     if self._secmgr is None:
         self._secmgr = getSecurityManager()
     # get all workspaces for user in the current context
     workspaces = user_workspaces(username, self.context)
     _you_can_see = lambda w: self._secmgr.checkPermission('View', w)
     _nolink = lambda w: {'absolute_url': '#', 'Title': w.Title()}
     # only provide links to workspaces the current auth. user can View:
     return [(w if _you_can_see(w) else _nolink(w)) for w in workspaces]
 def linked_workspaces(self, username):
     if self._secmgr is None:
         self._secmgr = getSecurityManager()
     # get all workspaces for user in the current context
     workspaces = user_workspaces(username, self.context)
     _you_can_see = lambda w: self._secmgr.checkPermission('View', w)
     _nolink = lambda w: {'absolute_url': '#', 'Title': w.Title()}
     # only provide links to workspaces the current auth. user can View:
     return [
         (w if _you_can_see(w) else _nolink(w)) for w in workspaces
         ]