コード例 #1
0
ファイル: workflow.py プロジェクト: boothead/karl
def reset_profile(event):
    """ Subscriber for IUserAddedGroup and IUserRemovedGroup events.

    o Find the profile corresponding to the user and update its ACL
      by resettings its security workflow
    """
    if (not IUserAddedGroup.providedBy(event) and
        not IUserRemovedGroup.providedBy(event)):
        return

    profiles = find_profiles(event.site)
    profile = profiles.get(event.id)
    if profile is not None:
        reset_security_workflow(profile)
コード例 #2
0
ファイル: workflow.py プロジェクト: lslaz1/karl
def reset_profile(event):
    """ Subscriber for IUserAddedGroup and IUserRemovedGroup events.

    o Find the profile corresponding to the user and update its ACL
      by resettings its security workflow
    """
    if (not IUserAddedGroup.providedBy(event)
            and not IUserRemovedGroup.providedBy(event)):
        return

    profiles = find_profiles(event.site)
    profile = profiles.get(event.id)
    if profile is not None:
        reset_security_workflow(profile)
コード例 #3
0
ファイル: contentfeeds.py プロジェクト: hathawsh/karl
def user_joined_community(event):
    if IUserAddedGroup.providedBy(event):
        delta = event.groups - event.old_groups
        joined = [x for x in delta if x.startswith(MEMBER_PREFIX)]
        events = find_events(event.site)
        if not events or not joined:
            return
        profile = event.site["profiles"][event.id]
        for group in joined:
            community_id, gtype = group[len(MEMBER_PREFIX) :].split(":")
            if gtype == "members":
                community = event.site["communities"].get(community_id)
                if community is None:
                    continue
                info = _getInfo(profile, community)
                info["flavor"] = "joined_left"
                info["operation"] = "joined"
                events.push(**info)
コード例 #4
0
ファイル: contentfeeds.py プロジェクト: iotest3/new
def user_joined_community(event):
    if IUserAddedGroup.providedBy(event):
        delta = event.groups - event.old_groups
        joined = [x for x in delta if x.startswith(MEMBER_PREFIX)]
        events = find_events(event.site)
        if not events or not joined:
            return
        profile = event.site['profiles'][event.id]
        for group in joined:
            community_id, gtype = group[len(MEMBER_PREFIX):].split(':')
            if gtype == 'members':
                community = event.site['communities'].get(community_id)
                if community is None:
                    continue
                info = _getInfo(profile, community)
                info['flavor'] = 'joined_left'
                info['operation'] = 'joined'
                events.push(**info)