[ARVADOS] updated: c0818b26246432407b8cd76a887dd61a7e824cd0
git at public.curoverse.com
git at public.curoverse.com
Fri Jun 12 10:53:02 EDT 2015
Summary of changes:
apps/workbench/app/controllers/users_controller.rb | 25 ++++++++++++++++++----
.../app/views/users/_setup_popup.html.erb | 19 ++++++++++------
2 files changed, 34 insertions(+), 10 deletions(-)
via c0818b26246432407b8cd76a887dd61a7e824cd0 (commit)
from 361e83e8ca5b3c55c4852f502a8fb7c82ff7bff5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit c0818b26246432407b8cd76a887dd61a7e824cd0
Author: radhika <radhika at curoverse.com>
Date: Fri Jun 12 10:51:26 2015 -0400
6254: add "groups" to user setup process; these comma separated groups entered in the popup will be saved as an array of groups property for the user's can_login link.
diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index f6d5711..d657f92 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -212,6 +212,22 @@ class UsersController < ApplicationController
end
if User.setup setup_params
+ if params[:groups]
+ new_groups = params[:groups].split(',').map(&:strip).compact.select{|i| !i.to_s.empty?}
+ can_login_perms = Link.where(tail_uuid: params[:user_email],
+ head_kind: 'arvados#user',
+ link_class: 'permission',
+ name: 'can_login')
+ if can_login_perms.any?
+ perm = can_login_perms.first
+ props = perm.properties
+ if new_groups != props[:groups]
+ props[:groups] = new_groups
+ perm.save!
+ end
+ end
+ end
+
format.js
else
self.render_error status: 422
@@ -329,14 +345,15 @@ class UsersController < ApplicationController
end
# oid login perm
- oid_login_perms = Link.where(tail_uuid: user.email,
+ can_login_perms = Link.where(tail_uuid: user.email,
head_kind: 'arvados#user',
link_class: 'permission',
name: 'can_login')
- if oid_login_perms.any?
- prefix_properties = oid_login_perms.first.properties
- current_selections[:identity_url_prefix] = prefix_properties[:identity_url_prefix]
+ if can_login_perms.any?
+ perm_properties = can_login_perms.first.properties
+ current_selections[:identity_url_prefix] = perm_properties[:identity_url_prefix]
+ current_selections[:groups] = perm_properties[:groups].andand.join(', ')
end
# repo perm
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index a1a664c..fcc3322 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -23,10 +23,11 @@
<% disable_url_prefix = identity_url_prefix != nil %>
<% selected_repo = @current_selections[:repo_name] %>
<% selected_vm = @current_selections[:vm_uuid] %>
+ <% groups = @current_selections[:groups] %>
<input id="user_uuid" maxlength="250" name="user_uuid" type="hidden" value="<%=uuid%>">
<div class="form-group">
- <label for="email">Email</label>
+ <label for="email">Email</label>
<% if disable_email %>
<input class="form-control" id="email" maxlength="250" name="email" type="text" value="<%=email%>" disabled>
<% else %>
@@ -51,16 +52,22 @@
<label for="vm_uuid">Virtual Machine</label>
<select class="form-control" name="vm_uuid">
<option value="" <%= 'selected' unless selected_vm %>>
- Choose One:
- </option>
+ Choose One:
+ </option>
<% @vms.each do |vm| %>
<option value="<%=vm.uuid%>"
- <%= 'selected' if selected_vm == vm.uuid %>>
- <%= vm.hostname %>
- </option>
+ <%= 'selected' if selected_vm == vm.uuid %>>
+ <%= vm.hostname %>
+ </option>
<% end %>
</select>
</div>
+ <div class="groups-group">
+ <label for="groups">Groups</label>
+ <input user_email="user_email" maxlength="250" name="user_email" type="hidden" value="<%=email%>">
+ <input class="form-control" id="groups" maxlength="250" name="groups" type="text" value="<%=groups%>"
+ title="Comma separated list of groups to which this user belongs">
+ </div>
</div>
<div class="modal-footer">
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list