[ARVADOS] created: d097d3a68ce71f277bb1fb3cd56f616bd30f67dc

git at public.curoverse.com git at public.curoverse.com
Fri Aug 1 09:30:45 EDT 2014


        at  d097d3a68ce71f277bb1fb3cd56f616bd30f67dc (commit)


commit d097d3a68ce71f277bb1fb3cd56f616bd30f67dc
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Fri Aug 1 09:28:33 2014 -0400

    Documentation for adding User Agreements (closes #3257)

diff --git a/doc/install/create-standard-objects.html.textile.liquid b/doc/install/create-standard-objects.html.textile.liquid
index eb25136..b46984a 100644
--- a/doc/install/create-standard-objects.html.textile.liquid
+++ b/doc/install/create-standard-objects.html.textile.liquid
@@ -56,3 +56,31 @@ read -rd $'\000' keepdisk <<EOF; arv keep_disk create --keep-disk "$keepdisk"
 }
 EOF
 </pre>
+
+h3. User Agreements
+
+If your user agreement is a file called "agreement.html" the following script will add it and create the necessary objects,
+in a new project called "User Documents":
+
+<pre>
+prefix=`arv --format=uuid user current | cut -d- -f1`
+anon_group_uuid="$prefix-j7d0g-anonymouspublic"
+project_uuid=`arv --format=uuid group create --group '{"group_class":"project","name":"User Documents"}'`
+agreement_uuid=`arv --format=uuid keep put hi_there.html --project-uuid=$project_uuid`
+read -rd $'\000' permission <<EOF; arv link create --link "$permission"
+{
+ "tail_uuid":"$anon_group_uuid",
+ "head_uuid":"$agreement_uuid",
+ "link_class":"permission",
+ "name":"can_read"
+}
+EOF
+read -rd $'\000' require <<EOF; arv link create --link "$require"
+{
+ "tail_uuid":"$prefix-tpzed-000000000000000",
+ "head_uuid":"$agreement_uuid",
+ "link_class":"signature",
+ "name":"require"
+}
+EOF
+</pre>

commit 9aff2a708f537ba991122e8496ea4c19f357610d
Author: Phil Hodgson <bitbucket at philhodgson.net>
Date:   Fri Aug 1 08:54:36 2014 -0400

    Adds a link in the user menu to see user agreements and modifies the user agreements index to always show signed and unsigned agreements (refs #3257)

diff --git a/apps/workbench/app/controllers/user_agreements_controller.rb b/apps/workbench/app/controllers/user_agreements_controller.rb
index 6ab8ae2..4649dc8 100644
--- a/apps/workbench/app/controllers/user_agreements_controller.rb
+++ b/apps/workbench/app/controllers/user_agreements_controller.rb
@@ -2,6 +2,22 @@ class UserAgreementsController < ApplicationController
   skip_before_filter :check_user_agreements
   skip_before_filter :find_object_by_uuid
 
+  def index
+    @required_user_agreements = []
+    @signed_user_agreements = []
+    signed_ua_uuids = UserAgreement.signatures.map &:head_uuid
+    UserAgreement.all.each do |ua|
+      ua_collection = Collection.find(ua.uuid)
+      if signed_ua_uuids.index(ua.uuid)
+        @signed_user_agreements << ua_collection
+      else
+        @required_user_agreements << ua_collection
+      end
+    end
+
+    super
+  end
+
   def model_class
     Collection
   end
diff --git a/apps/workbench/app/views/layouts/body.html.erb b/apps/workbench/app/views/layouts/body.html.erb
index 55c9d81..663e2ca 100644
--- a/apps/workbench/app/views/layouts/body.html.erb
+++ b/apps/workbench/app/views/layouts/body.html.erb
@@ -45,6 +45,11 @@
             <ul class="dropdown-menu" role="menu">
               <% if current_user.is_active %>
               <li role="presentation"><a href="/manage_account" role="menuitem"><i class="fa fa-key fa-fw"></i> Manage account</a></li>
+              <li role="presentation">
+                <%= link_to user_agreements_path, :role => "menuitem" do %>
+                  <i class="fa fa-book fa-fw"></i> User Agreements
+                <% end %>
+              </li>
               <li role="presentation" class="divider"></li>
               <% end %>
               <li role="presentation"><a href="<%= logout_path %>" role="menuitem"><i class="fa fa-sign-out fa-fw"></i> Log out</a></li>
diff --git a/apps/workbench/app/views/user_agreements/index.html.erb b/apps/workbench/app/views/user_agreements/index.html.erb
index 49516eb..bcbe480 100644
--- a/apps/workbench/app/views/user_agreements/index.html.erb
+++ b/apps/workbench/app/views/user_agreements/index.html.erb
@@ -1,11 +1,13 @@
 <% content_for :breadcrumbs do raw '<!-- -->' end %>
 
+<% if @required_user_agreements && @required_user_agreements.any? %>
+
 <% n_files = @required_user_agreements.collect(&:files).flatten(1).count %>
 <% content_for :page_title do %>
 <% if n_files == 1 %>
 <%= @required_user_agreements.first.files.first[1].sub(/\.[a-z]{3,4}$/,'') %>
 <% else %>
-User agreements
+  <h2>User agreements</h2>
 <% end %>
 <% end %>
 
@@ -38,6 +40,23 @@ User agreements
 </div>
 <% end %>
 
+<% end %>
+
+<% if @signed_user_agreements && @signed_user_agreements.any? %>
+  <h2>Accepted User Agreements</h2>
+  <ul>
+    <% @signed_user_agreements.each do |ua| %>
+      <% ua.files.each do |file| %>
+        <li>
+          <%= file[1].sub(/\.[a-z]{3,4}$/,'') %>
+          <%= link_to 'View agreement', {controller: 'collections', action: 'show_file', uuid: ua.uuid, file: "#{file[0]}/#{file[1]}"}, {target: '_blank', class: 'btn btn-mini btn-primary'} %>
+        </li>
+      <% end %>
+    <% end %>
+  </ul>
+<% end %>
+
+
 <% content_for :footer_js do %>
 $('#open_user_agreement input[name="checked[]"]').on('click', function() {
     var dialog = $('#open_user_agreement')[0]

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list