Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install borg.supergroup

How to install borg.supergroup

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install borg.supergroup
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.0rc1 Available View build log
Windows (64-bit)
1.0rc1 Available View build log
Mac OS X (10.5+)
1.0rc1 Available View build log
Linux (32-bit)
1.0rc1 Available View build log
Linux (64-bit)
1.0rc1 Available View build log
 
Author
License
LGPL
Dependencies
Imports
Lastest release
version 1.0rc1 on Jan 5th, 2011

This is a PAS plugin that makes it possible to create groups "on the fly" for users via subscription adapters and utilities.

The plugin can be installed using a GenericSetup extension profile.

For example, say you have an LDAP repository where a user property contains a user's business unit. If this is mapped as a user property, you can write a subscription adapter that adapts the user to ISuperGroups. It would look up this property on a user and return a list of group ids that corresponds to the value of the property. When Plone lists a user's groups or assigns roles based on a user's groups, the user will appear to be a member of this group.

For example:

System Message: WARNING/2 (<string>, line 18)

Literal block expected; none found.

from zope.interface import implements from zope.component import adapts

from borg.supergroup.interfaces import ISuperGroups from Products.PluggableAuthService.interfaces.authservice import IBasicUser

class ImpliedGroups(object): implements(ISuperGroups) adapts(IBasicUser)

def __init__(self, context): self.principal = context

def __call__(self): implied = self.principal.getProperty('implied_group', '') if implied: yield implied

This can be registered in ZCML with:

<subscriber factory=".groups.ImpliedGroups" />

This is a simple example that looks for an implied group in the 'implied_groups' user property. Of course, you could source the group(s) from wherever you want. The return value should be an iterable (here we use a generator).

To make implied groups show up in general group listings (e.g. on the 'Sharing' tab in the Plone user interface), you could write a named utility providing ISuperGroupsEnumeration. This will be passed some search parameters, and should return any implied groups if they can be matched to the search parameters.

For example:

System Message: WARNING/2 (<string>, line 53)

Literal block expected; none found.

from zope.interface import implements from zope.component import adapts

from borg.supergroup.interfaces import ISuperGroupsEnumeration

class ImpliedGroupsEnumeration(object): implements(ISuperGroupsEnumeration)

def enumerate_groups(self, id=None, exact_match=False, **kw): if (exact_match and id == 'Alpha') or (not exact_match and id in 'Alpha'): yield dict(id='Alpha', title='Alpha Group')

System Message: WARNING/2 (<string>, line 61); backlink

Inline strong start-string without end-string.

In ZCML, this would be registered with:

<utility

System Message: ERROR/3 (<string>, line 68)

Inconsistent literal block quoting.

factory=".groups.ImpliedGroupsEnumeration" name="my.implied.groups" />

For more examples, see the tests in integration.txt and the interface declarations in interfaces.py. Changelog =========

1.0b1 - Unreleased

System Message: WARNING/2 (<string>, line 78)

Title underline too short.

1.0b1 - Unreleased
----------------
  • Initial release

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:3

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.