X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/3c4367d8e03450e9a73e61f4247145d2b6c86a33..959d888c17d1403d2eeecc19bc4b5e2c8d1debf6:/Products/Plinn/skins/control/remove_group_roles.py diff --git a/Products/Plinn/skins/control/remove_group_roles.py b/Products/Plinn/skins/control/remove_group_roles.py new file mode 100755 index 0000000..d64394c --- /dev/null +++ b/Products/Plinn/skins/control/remove_group_roles.py @@ -0,0 +1,20 @@ +##parameters=groupId, roles=[], ajax='', REQUEST=None + +aclu = context.aq_inner.acl_users +prefix = aclu.getGroupPrefix() +group = context.portal_groups.getGroupById(groupId) +newRoles = [role for role in group.getUserRoles() if role not in roles] + +try : + prefixLen = len(prefix) + groups = [ g[prefixLen:] for g in group.getGroups(no_recurse = 1) ] +except : + groups = [] + +aclu.changeUser(groupId, groups = groups, roles = newRoles ) + +if REQUEST is not None : + from ZTUtils import make_query as mq + url = context.portal_url() + red = REQUEST.RESPONSE.redirect + return red('%s/group_data?%s' % (url, mq(group=groupId, ajax=ajax))) \ No newline at end of file