Commit 9fcb7d84 authored by Maxim's avatar Maxim
Browse files

Rechte bei Diensten eingefügt, Bug bei Diensten daten gefixt

parent 627fc99a
......@@ -106,23 +106,18 @@ class Group
role = r.nil? ? Roles::GUEST : r.role
member.role = role
users.push(member)
if(m['id'] == my_id)
my_role = member.role
end
users.push(member)
end
return users,my_role
end
def get_my_role(id)
self.member.each do |m|
if(m['id'] == id)
role = m['role']
end
end
end
def get_member_cababilities(id)
res = RestClient.get("#{ENV['API_URL']}groups/#{id}/members")
......
......@@ -4,9 +4,9 @@ class ConsumerController < ApplicationController
@consumer_id = Integer(params[:id])
@group = Group.get(@group_id)
@consumers = Group.get_consumers(@group_id)
@members,@my_role = Group.get_members(@group_id, session[:user_id])
@test = session[:user_id]
@more_selected = @consumers.filter { |c| c.id == @consumer_id }.empty?
@members,@my_role = Group.get_members(@group_id, session[:user_id])
data = Group.get_capabilities(@group_id, @consumer_id)
......
......@@ -14,6 +14,7 @@ class GroupController < ApplicationController
end
def get
@test = session[:user_id]
@group_id = Integer(params[:id])
@group = Group.get(params[:id])
@members,@my_role = Group.get_members(params[:id], session[:user_id])
......@@ -54,6 +55,7 @@ class GroupController < ApplicationController
@group_id = Integer(params[:gid])
@group = Group.get(params[:gid])
@consumers = Group.get_consumers(params[:gid])
@members,@my_role = Group.get_members(params[:gid], session[:user_id])
@info = "Hier findest Du eine Übersicht aller Dienste.
Durch einen Klick auf den jeweiligen Dienst gelangst Du zur Rechtevergabe.
Um wieder zurück auf die <b>Mitgliederliste</b> zu gelangen, reicht ein Klick auf den Reiter “Mitglieder”.
......
......@@ -3,6 +3,8 @@
<br>
<%= t('consumer.'+ @consumer_id.to_s + '.description') %>
<br><br>
<table class="table">
<thead>
<tr>
......@@ -17,20 +19,45 @@
</tr>
</thead>
<tbody>
<% @users.each do |m| %>
<tr>
<td><%= m.login %></td>
<% m.capabilities.each_with_index do |c, i| %>
<td>
<input class="form-check-input position-static ml-1" type="checkbox"
data-uid="<%= m.id %>" data-cid="<%= @capabilities[i].id %>"
autocomplete="off" <%= "data-initial checked" if c %>
>
</td>
<% end %>
</tr>
<% if @my_role == Roles::ADMIN %>
<% @users.each do |m| %>
<tr>
<td><%= m.login %></td>
<% m.capabilities.each_with_index do |c, i| %>
<td>
<input class="form-check-input position-static ml-1" type="checkbox"
data-uid="<%= m.id %>" data-cid="<%= @capabilities[i].id %>"
autocomplete="off" <%= "data-initial checked" if c %>
>
</td>
<% end %>
</tr>
<% end %>
<% end %>
<% if @my_role == Roles::MEMBER %>
<% @users.each do |m| %>
<tr>
<td><%= m.login %></td>
<% m.capabilities.each_with_index do |c, i| %>
<td>
<input class="form-check-input position-static ml-1" type="checkbox"
data-uid="<%= m.id %>" data-cid="<%= @capabilities[i].id %>"
autocomplete="off" disabled <%= "data-initial checked" if c %>
>
</td>
<% end %>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<button class="mr-3 btn btn-primary" id="permission-save"><%= t('consumer.saveButton') %></button>
<% if @my_role == Roles::ADMIN %>
<button class="mr-3 btn btn-primary" id="permission-save"><%= t('consumer.saveButton') %></button>
<% end %>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment