Déplacement pour eggification.
[Plinn.git] / Products / Plinn / skins / control / remove_group_roles.py
1 ##parameters=groupId, roles=[], ajax='', REQUEST=None
2
3 aclu = context.aq_inner.acl_users
4 prefix = aclu.getGroupPrefix()
5 group = context.portal_groups.getGroupById(groupId)
6 newRoles = [role for role in group.getUserRoles() if role not in roles]
7
8 try :
9 prefixLen = len(prefix)
10 groups = [ g[prefixLen:] for g in group.getGroups(no_recurse = 1) ]
11 except :
12 groups = []
13
14 aclu.changeUser(groupId, groups = groups, roles = newRoles )
15
16 if REQUEST is not None :
17 from ZTUtils import make_query as mq
18 url = context.portal_url()
19 red = REQUEST.RESPONSE.redirect
20 return red('%s/group_data?%s' % (url, mq(group=groupId, ajax=ajax)))