Merge pull request #133 from cloudbuilders/user_list
user listing improvements
This commit is contained in:
@@ -59,7 +59,7 @@ class AddUser(forms.SelfHandlingForm):
|
||||
except api_exceptions.ApiException, e:
|
||||
messages.error(request, 'Unable to create user association: %s' %
|
||||
(e.message))
|
||||
return redirect('syspanel_tenants')
|
||||
return redirect('syspanel_tenant_users', tenant_id=data['tenant'])
|
||||
|
||||
|
||||
class RemoveUser(forms.SelfHandlingForm):
|
||||
@@ -79,7 +79,7 @@ class RemoveUser(forms.SelfHandlingForm):
|
||||
except api_exceptions.ApiException, e:
|
||||
messages.error(request, 'Unable to create tenant: %s' %
|
||||
(e.message))
|
||||
return redirect('syspanel_tenants')
|
||||
return redirect('syspanel_tenant_users', tenant_id=data['tenant'])
|
||||
|
||||
|
||||
class CreateTenant(forms.SelfHandlingForm):
|
||||
@@ -243,22 +243,15 @@ def users(request, tenant_id):
|
||||
|
||||
users = api.account_api(request).users.get_for_tenant(tenant_id)
|
||||
all_users = api.account_api(request).users.list()
|
||||
new_user_ids = []
|
||||
user_ids = [u.id for u in users]
|
||||
all_user_ids = [u.id for u in all_users]
|
||||
for uid in all_user_ids:
|
||||
if not uid in user_ids:
|
||||
new_user_ids.append(uid)
|
||||
for i in user_ids:
|
||||
if i in new_user_ids:
|
||||
new_user_ids.remove(i)
|
||||
new_users = [u for u in all_users if not u.id in user_ids]
|
||||
return render_to_response(
|
||||
'django_openstack/syspanel/tenants/users.html', {
|
||||
'add_user_form': add_user_form,
|
||||
'remove_user_form': remove_user_form,
|
||||
'tenant_id': tenant_id,
|
||||
'users': users,
|
||||
'new_users': new_user_ids,
|
||||
'new_users': new_users,
|
||||
}, context_instance=template.RequestContext(request))
|
||||
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
<input name="user" type="hidden" value="{{user}}" />
|
||||
<input name="user" type="hidden" value="{{user.id}}" />
|
||||
<input name="tenant" type="hidden" value="{{tenant_id}}" />
|
||||
<input id="add_tenant_user_{{user}}" class="add" ttle="User: {{user}}" type="submit" value="Add" />
|
||||
<input id="add_tenant_user_{{user.id}}" class="add" title="User: {{user.id}}" type="submit" value="Add" />
|
||||
</form>
|
||||
|
@@ -18,6 +18,7 @@
|
||||
{% if users %}
|
||||
<table class="wide">
|
||||
<tr id='headings'>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Actions</th>
|
||||
@@ -26,6 +27,7 @@
|
||||
{% for user in users %}
|
||||
<tr class="{% cycle 'odd' 'even' %}">
|
||||
<td>{{user.id}}</td>
|
||||
<td>{{user.name}}</td>
|
||||
<td>{{user.email}}</td>
|
||||
<td id="actions">
|
||||
<ul>
|
||||
@@ -46,13 +48,15 @@
|
||||
<h3>Add new users</h3>
|
||||
<table class="wide">
|
||||
<tr id='headings'>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
<tbody class='main'>
|
||||
{% for user in new_users %}
|
||||
<tr class="{% cycle 'odd' 'even' %}">
|
||||
<td>{{user}}</td>
|
||||
<td>{{user.id}}</td>
|
||||
<td>{{user.name}}</td>
|
||||
<td id="actions">
|
||||
<ul>
|
||||
<li class="form">{% include "django_openstack/syspanel/tenants/_add_user.html" with form=add_user_form %}</li>
|
||||
|
@@ -17,6 +17,7 @@
|
||||
<table class="wide">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
<th>Default Tenant</th>
|
||||
<th>Options</th>
|
||||
@@ -24,6 +25,7 @@
|
||||
{% for user in users %}
|
||||
<tr class="{% cycle 'odd' 'even' %}">
|
||||
<td>{{user.id}}{% if not user.enabled %} (disabled){% endif %}</td>
|
||||
<td>{{user.name}}</td>
|
||||
<td>{{user.email}}</td>
|
||||
<td>{{user.tenantId}}</td>
|
||||
<td id="actions">
|
||||
|
Reference in New Issue
Block a user