Avancement du refactoring.
[Plinn.git] / skins / control / remove_groups.py
1 ##parameters=groups=[], ajax=''
2 sd = context.session_data_manager.getSessionData()
3 groupPrefix = context.acl_users.getGroupPrefix()
4 prefixLenght = len(groupPrefix)
5
6 if sd is not None :
7 if sd.has_key('requestedGroup') and sd['requestedGroup'] in groups :
8 sd['requestedGroup'] = None
9
10 context.portal_groups.removeGroups([ groupId[prefixLenght:] for groupId in groups], keep_workspaces=1)
11 from ZTUtils import make_query as mq
12 url = context.portal_url()
13 red = context.REQUEST.RESPONSE.redirect
14 msg = not groups and 'Please select one or more groups before.' or (len(groups) == 1 and 'Group deleted.' or 'Groups deleted.')
15 return red('%s/portal_all_groups?%s' % (url, mq(portal_status_message=msg, ajax=ajax)))