1 class Arvados::V1::RepositoriesController < ApplicationController
2 before_filter :admin_required, :only => :get_all_permissions
3 def get_all_permissions
5 User.includes(:authorized_keys).all.each do |u|
10 @repos = Repository.includes(:permissions).all
12 gitolite_permissions = ''
14 repo.permissions.each do |perm|
15 if perm.tail_kind == 'arvados#group'
16 @users.each do |user_uuid, user|
17 user.group_permissions.each do |group_uuid, perm_mask|
19 perms << {name: 'can_write', user_uuid: user_uuid}
20 elsif perm_mask[:read]
21 perms << {name: 'can_read', user_uuid: user_uuid}
26 perms << {name: perm.name, user_uuid: perm.tail_uuid}
30 user_uuid = perm[:user_uuid]
31 @user_aks[user_uuid] = @users[user_uuid].andand.authorized_keys.andand.
34 public_key: ak.public_key,
35 authorized_key_uuid: ak.uuid
38 if @user_aks[user_uuid].any?
39 @repo_info[repo.uuid] ||= {
42 push_url: repo.push_url,
43 fetch_url: repo.fetch_url,
46 ri = (@repo_info[repo.uuid][:user_permissions][user_uuid] ||= {})
47 ri[perm[:name]] = true
51 @repo_info.values.each do |repo_users|
52 repo_users[:user_permissions].each do |user_uuid,perms|
54 perms[:gitolite_permissions] = 'RW'
55 perms['can_read'] = true
56 elsif perms['can_read']
57 perms[:gitolite_permissions] = 'R'
62 kind: 'arvados#RepositoryPermissionSnapshot',
63 repositories: @repo_info.values,