Dans certains cas, il n'y a pas encore de balise <base> dans l'en-tĂȘte. On l'ajoute...
[Plinn.git] / skins / control / append_group_role.py
1 ##parameters=groupId, role, ajax='', REQUEST=None
2
3 aclu = context.aq_inner.acl_users
4 prefix = aclu.getGroupPrefix()
5 group = context.portal_groups.getGroupById(groupId)
6 roles = list(group.getUserRoles()[:])
7 roles.append(role)
8
9 try :
10 prefixLen = len(prefix)
11 groups = [ g[prefixLen:] for g in group.getGroups(no_recurse = 1) ]
12 except :
13 groups = []
14
15 aclu.changeUser(groupId, groups = groups, roles = roles )
16
17 if REQUEST is not None :
18 from ZTUtils import make_query as mq
19 url = context.portal_url()
20 red = REQUEST.RESPONSE.redirect
21 return red('%s/group_data?%s' % (url, mq(group=groupId, ajax=ajax)))