def rest_group_user_all(request, group_name): # Get the repository and add the user group = Group(group_name) group.load() users = group.member_list logger.debug(len(users)) users_name = map(lambda foo: foo.__unicode__(), users) json_reply = json.dumps(users_name) return HttpResponse(json_reply)
def rest_group_user_all(request, group_name): # Get the repository and add the user group = Group(group_name) group.load() users = group.member_list logger.debug(len(users)) users_name = map(lambda foo: foo.__unicode__(), users) json_reply = json.dumps(users_name) return HttpResponse(json_reply)
def rest_group_user(request, group_name, username): group = Group(group_name) group.load() user = UserFactory.instantiate_user(username) # Add member to the group if request.method == 'POST': group.add_user(user) group.save() return HttpResponse("User " + username + " added to " + group_name) # Remove a group member if request.method == 'DELETE': group.remove_user(user) group.save() return HttpResponse(username + " removed from " + group_name)
def add_group_user_dialog(request, group_name): # retrieve all the users user_list = UserApache.retrieve_all() # get the users already added to the repository group = Group(group_name) group.load() group_user_list = group.member_list # substract the repository users from the user list for group_user in group_user_list: if group_user in user_list: user_list.remove(group_user) everyone = UserFactory.instantiate_user('everyone') user_list.remove(everyone) return render_to_response('gitstack/add_group_user.html', {'group_name': group_name, 'user_list': user_list }, context_instance=RequestContext(request))
def rest_group_user(request, group_name, username): group = Group(group_name) group.load() user = UserFactory.instantiate_user(username) # Add member to the group if request.method == 'POST': try: group.add_user(user) group.save() return HttpResponse("User " + username + " added to " + group_name) except Exception as e: return HttpResponseServerError(e) # Remove a group member if request.method == 'DELETE': group.remove_user(user) group.save() return HttpResponse(username + " removed from " + group_name)
def add_group_user_dialog(request, group_name): # retrieve all the users user_list = UserApache.retrieve_all() # get the users already added to the repository group = Group(group_name) group.load() group_user_list = group.member_list # substract the repository users from the user list for group_user in group_user_list: if group_user in user_list: user_list.remove(group_user) everyone = UserFactory.instantiate_user('everyone') user_list.remove(everyone) return render_to_response('gitstack/add_group_user.html', { 'group_name': group_name, 'user_list': user_list }, context_instance=RequestContext(request))