예제 #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
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)