Skip to content

Commit

Permalink
fix available users and groups on share
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Glatthard committed Aug 12, 2015
1 parent 5e51859 commit 087eac0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion ipynbsrv/api/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class NestedShareSerializer(serializers.ModelSerializer):
"""
tags = TagSerializer(many=True, read_only=True)
members = NestedBackendUserSerializer(source='get_members', many=True, read_only=True)
access_groups = NestedCollaborationGroupSerializer(many=True, read_only=True)
access_groups = FlatCollaborationGroupSerializer(many=True, read_only=True)
owner = NestedBackendUserSerializer(many=False, read_only=True)

class Meta:
Expand Down
22 changes: 0 additions & 22 deletions ipynbsrv/web/templates/web/shares/manage.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,6 @@ <h2>Shared with...</h2>
</td>
</tr>
{% endfor %}

{% for user in users %}
{% if user.backend_user.collab_group in share.access_groups %}
<tr>
<td><a href="{% url 'group_manage' user.backend_user.collab_group.id %}">{{ user.backend_user.collab_group.name }}</a></td>
<td style="text-align: right">
{% if request.user.backend_user.id == share.owner.id %}
{% if member.backend_user.id != share.owner %}
<form action="{% url 'share_remove_access_group' %}" method="POST" role="form" class="form-action">
{% csrf_token %}
<input type="hidden" name="share_id" value="{{ share.id }}">
<input type="hidden" name="access_group" value="{{ user.backend_user.collab_group.id }}">
<button class="btn btn-sm btn-danger" title="Remove from share?" data-toggle="confirmation" data-placement="left">
<i class="glyphicon glyphicon-remove" aria-hidden="true"></i>
</button>
</form>
{% endif %}
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

Expand Down
2 changes: 1 addition & 1 deletion ipynbsrv/web/templates/web/shares/modal_addgroups.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h4 class="modal-title">Add share user</h4>
<div class="select">
<select class="enableMultiselectCaseInsensitiveFiltering" multiple="multiple" name="access_groups">
{% for group in groups %}
{% if group not in share.access_groups and not group.is_single_user_group %}
{% if group.id not in share.access_group_ids and not group.is_single_user_group %}
<option value="{{ group.id }}">{{ group.name }}</option>
{% endif %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions ipynbsrv/web/templates/web/shares/modal_addusers.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ <h4 class="modal-title">Add share user</h4>
<div class="modal-body">

<div class="form-group">
<label for="access_groups">Groups</label>
<label for="access_groups">Users</label>
<div class="select">
<select class="enableMultiselectCaseInsensitiveFiltering" multiple="multiple" name="access_groups">
{% for user in users %}
{% if user.backend_user.collab_group %}
{% if user.backend_user.collab_group not in share.access_groups and user != request.user %}
{% if user.backend_user.collab_group.id not in share.access_group_ids and user != request.user %}
<option value="{{ user.backend_user.collab_group.id }}">{{ user.backend_user.collab_group.name }}</option>
{% endif %}
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions ipynbsrv/web/views/shares.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ def manage(request, share_id):

client = get_httpclient_instance(request)
share = client.shares(share_id).get()
share['access_group_ids'] = [g.id for g in share.access_groups]
users = client.users.get()
groups = client.collaborationgroups.get()
new_notifications_count = len(client.notificationlogs.unread.get())
Expand Down

0 comments on commit 087eac0

Please sign in to comment.