Exemple #1
0
def evolve(site):
    """
    reset profile ACL to remove 'view_only' permission (replacing any usage
    with 'view')

    add 'industry' to column in people report
    """
    def out(msg):
        sys.stderr.write(msg)
        sys.stderr.write('\n')
        sys.stderr.flush()

    acount = 0
    icount = 0
    ucount = 0
    profiles = find_profiles(site)
    for docid, profile in profiles.items():
        state = getattr(profile, 'security_state', None)
        if state == "active":
            to_profile_active(profile, None)
            acount += 1
        elif state == "inactive":
            to_profile_inactive(profile, None)
            icount += 1
        else:
            ucount += 1
    out("%s affected, %s active, %s inactive, %s unknown" %
        (acount + icount, acount, icount, ucount))

    if 'people' in site:
        people = site['people']
        for key in people.keys():
            obj1 = people[key]
            for key2 in obj1.keys():
                obj2 = obj1[key2]
                if not hasattr(obj2, "columns"):
                    continue
                colvals = obj2.columns
                if len(colvals) != 4:  # won't have the default
                    continue
                # if the report contains the default columns, then replace
                # them with the new default columns
                if colvals[0] == 'name' and colvals[1] == 'organization' \
                        and colvals[2] == 'location' and colvals[3] == 'email':
                    obj2.columns = ('name', 'organization', 'location',
                                    'industry', 'email')

    transaction.commit()
Exemple #2
0
def evolve(site):
    """
    reset profile ACL to remove 'view_only' permission (replacing any usage
    with 'view')

    add 'industry' to column in people report
    """

    def out(msg):
        sys.stderr.write(msg)
        sys.stderr.write('\n')
        sys.stderr.flush()

    acount = 0
    icount = 0
    ucount = 0
    profiles = find_profiles(site)
    for docid, profile in profiles.items():
        state = getattr(profile, 'security_state', None)
        if state == "active":
            to_profile_active(profile, None)
            acount += 1
        elif state == "inactive":
            to_profile_inactive(profile, None)
            icount += 1
        else:
            ucount += 1
    out("%s affected, %s active, %s inactive, %s unknown" % (
        acount+icount, acount, icount, ucount))

    if 'people' in site:
        people = site['people']
        for key in people.keys():
            obj1 = people[key]
            for key2 in obj1.keys():
                obj2 = obj1[key2]
                if not hasattr(obj2, "columns"):
                    continue
                colvals = obj2.columns
                if len(colvals) != 4:  # won't have the default
                    continue
                # if the report contains the default columns, then replace
                # them with the new default columns
                if colvals[0] == 'name' and colvals[1] == 'organization' \
                        and colvals[2] == 'location' and colvals[3] == 'email':
                    obj2.columns = ('name', 'organization', 'location', 'industry', 'email')

    transaction.commit()
Exemple #3
0
 def _callFUT(self, ob, transition):
     from karl.workflow import to_profile_active
     return to_profile_active(ob, transition)
Exemple #4
0
 def _callFUT(self, ob, transition):
     from karl.workflow import to_profile_active
     return to_profile_active(ob, transition)