Esempio n. 1
0
 def __init__(self,
              context,
              parent=None,
              groupid=u'',
              title=u'',
              description=u'',
              namespace=u'',
              roles=(),
              members=None,
              **kwargs):
     if not IWorkspaceContext.providedBy(context):
         raise ValueError('Could not adapt: context not a workspace')
     schema = interfaces.IWorkspaceGroup
     if schema.providedBy(parent):
         self.__parent__ = parent
     self.context = context
     self.adapts_project = IProjectContext.providedBy(context)
     valid_setattr(self, schema['baseid'], _decode(groupid))
     valid_setattr(self, schema['title'], _decode(title))
     valid_setattr(self, schema['description'], _decode(description))
     valid_setattr(self, schema['namespace'], _decode(namespace))
     self._keys = None
     self.portal = getSite()
     self.site_members = members or interfaces.ISiteMembers(self.portal)
     groups = Groups(self.portal)
     groupname = self.pas_group()[0]
     if groupname not in groups:
         groups.add(groupname)  # edge-case: may cause write-on-read
     self._group = GroupInfo(groupname, members=self.site_members)
Esempio n. 2
0
 def __init__(self, context, request):
     self.context = context
     self.request = request
     self.portal = getSite()
     self.site_members = SiteMembers(self.portal, self.request)
     self.mtool = getToolByName(context, 'portal_membership')
     self.roster = WorkspaceRoster(context)
     self.title = self.context.Title().decode('utf-8')
     self.path = '/'.join(self.context.getPhysicalPath())
     self.status = IStatusMessage(self.request)
     self.isproject = IProjectContext.providedBy(context)
Esempio n. 3
0
 def __init__(self, context):
     self.adapts_project = IProjectContext.providedBy(context)
     self._load_config()
     super(WorkspaceRoster, self).__init__(
         context,
         parent=None,
         groupid=self._base['groupid'],
         title=self._base['title'],
         description=self._base['description'],
         namespace=group_namespace(context),
         )
     self._load_groups()
Esempio n. 4
0
 def test_interfaces(self):
     """Test any interface bindings configured on content"""
     ## these are markers hooked up to Products.qi types in
     ## configure.zcml for uu.qiext:
     from Products.qi.extranet.types import project, team, subteam
     from uu.qiext.interfaces import IWorkspaceContext
     from uu.qiext.interfaces import IProjectContext, ITeamContext
     assert IWorkspaceContext.providedBy(project.Project('project'))
     assert IWorkspaceContext.providedBy(team.Team('team'))
     assert IWorkspaceContext.providedBy(subteam.SubTeam('subteam'))
     assert IProjectContext.providedBy(project.Project('project'))
     assert ITeamContext.providedBy(team.Team('team'))
     assert ITeamContext.providedBy(subteam.SubTeam('subteam'))
Esempio n. 5
0
def sync_group_roles(context, groupname):
    """
    Given a group name as a full PAS groupname, infer appropriate
    roles for that group based on configuration, and bind those
    local roles to the context.
    """
    always_inherit_local_roles(context)
    manager = LocalRolesView(context, request_for(context))
    if IProjectContext.providedBy(context):
        roles = _project_roles_for(groupname)
    else:
        roles = _workspace_roles_for(groupname)
    manager.update_role_settings([grouproles(groupname, roles)])
Esempio n. 6
0
def project_for(context):
    if IProjectContext.providedBy(context):
        return context
    return find_parent(context, iface=IProjectContext)
Esempio n. 7
0
 def __init__(self, context, request):
     if not IProjectContext.providedBy(context):
         raise ValueError('Can only purge from top-level projects')
     super(PurgeUserView, self).__init__(context, request)