[PATCH conductor] User/Group profile UI to show permission grants

Scott Seago sseago at redhat.com
Mon Aug 13 14:42:32 UTC 2012


---
 src/app/controllers/application_controller.rb     |   37 ++++++++++++
 src/app/controllers/permissions_controller.rb     |   33 ++++++++---
 src/app/controllers/user_groups_controller.rb     |   11 +++-
 src/app/controllers/users_controller.rb           |    1 +
 src/app/models/common_filter_methods.rb           |    9 ++-
 src/app/models/derived_permission.rb              |   61 ++++++++++++++++++++-
 src/app/models/permission.rb                      |   61 ++++++++++++++++++++-
 src/app/models/role.rb                            |   10 +++
 src/app/models/user.rb                            |    2 +-
 src/app/models/user_group.rb                      |    5 ++
 src/app/views/permissions/_objects.html.haml      |   62 +++++++++++++++++++++
 src/app/views/user_groups/_list.html.haml         |    2 +-
 src/app/views/user_groups/show.html.haml          |    5 ++
 src/app/views/users/show.html.haml                |    7 ++-
 src/config/locales/en.yml                         |    2 +
 src/config/routes.rb                              |    1 +
 src/features/step_definitions/permission_steps.rb |    5 ++
 src/features/user.feature                         |    7 ++
 src/features/user_group.feature                   |    7 ++
 19 files changed, 309 insertions(+), 19 deletions(-)
 create mode 100644 src/app/views/permissions/_objects.html.haml

diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index b6381ff..588bb12 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -311,6 +311,43 @@ class ApplicationController < ActionController::Base
     %w[asc desc].include?(params[:order_dir]) ? params[:order_dir] : "asc"
   end
 
+  def add_profile_permissions_inline(entity, path_prefix = '')
+    @entity = entity
+    @path_prefix = path_prefix
+    @roles = Role.all_by_scope
+    @inline = true
+    @show_inherited = params[:show_inherited]
+    @show_global = params[:show_global]
+    if @show_inherited
+      local_perms = @entity.derived_permissions
+    else
+      local_perms = @entity.permissions
+    end
+    @permissions = paginate_collection(local_perms.
+      apply_filters(:preset_filters_options =>
+                      Permission::PROFILE_PRESET_FILTERS_OPTIONS,
+                    :preset_filter_id =>
+                      params[:profile_permissions_preset_filter],
+                    :search_filter =>
+                      [params[:profile_permissions_search],
+                       params[:profile_permissions_preset_filter]]),
+                                       params[:page])
+
+    @permission_list_header = []
+    unless (@show_inherited)
+      @permission_list_header <<
+        { :name => 'checkbox', :class => 'checkbox', :sortable => false }
+    end
+    @permission_list_header += [
+      { :name => t('permissions.resource')},
+      { :name => t("role"), :sort_attr => :role},
+    ]
+    if @show_inherited
+      @permission_list_header <<
+        { :name => t('permissions.inherited_from'), :sortable => false }
+    end
+  end
+
   def add_permissions_inline(perm_obj, path_prefix = '', polymorphic_path_extras = {})
     @permission_object = perm_obj
     require_privilege(Privilege::VIEW, @permission_object)
diff --git a/src/app/controllers/permissions_controller.rb b/src/app/controllers/permissions_controller.rb
index 9b56a49..cd80e02 100644
--- a/src/app/controllers/permissions_controller.rb
+++ b/src/app/controllers/permissions_controller.rb
@@ -173,6 +173,14 @@ class PermissionsController < ApplicationController
     redirect_to_original({"entities_preset_filter" => params[:entities_preset_filter], "entities_search" => params[:entities_search]})
   end
 
+  def profile_filter
+    redirect_to_original({"profile_permissions_preset_filter" =>
+                             params[:profile_permissions_preset_filter],
+                          "profile_permissions_search" =>
+                             (params[:profile_permissions_preset_filter].empty? ?
+                              nil : params[:profile_permissions_search])})
+  end
+
   private
 
   def load_entities
@@ -195,6 +203,7 @@ class PermissionsController < ApplicationController
   def set_permission_object (required_role=Privilege::PERM_SET)
     obj_type = params[:permission_object_type]
     id = params[:permission_object_id]
+    @return_path = params[:return_path]
     @path_prefix = params[:path_prefix]
     @polymorphic_path_extras = params[:polymorphic_path_extras]
     @use_tabs = params[:use_tabs]
@@ -209,16 +218,20 @@ class PermissionsController < ApplicationController
       end
     end
     raise RuntimeError, "invalid permission object" if @permission_object.nil?
-    if @permission_object == BasePermissionObject.general_permission_scope
-      @return_path = permissions_path
-      set_admin_users_tabs 'permissions'
-    else
-      @return_path = send("#{@path_prefix}polymorphic_path",
-                          @permission_object.respond_to?(:to_polymorphic_path_param) ?
-                              @permission_object.to_polymorphic_path_param(@polymorphic_path_extras) :
-                              @permission_object,
-                          @use_tabs == "yes" ? {:details_tab => :permissions,
-                                                :only_tab => true} : {})
+    unless @return_path
+      if @permission_object == BasePermissionObject.general_permission_scope
+        @return_path = permissions_path
+        set_admin_users_tabs 'permissions'
+      else
+        @return_path = send("#{@path_prefix}polymorphic_path",
+                            @permission_object.respond_to?(
+                              :to_polymorphic_path_param) ?
+                            @permission_object.to_polymorphic_path_param(
+                              @polymorphic_path_extras) :
+                            @permission_object,
+                            @use_tabs == "yes" ? {:details_tab => :permissions,
+                              :only_tab => true} : {})
+      end
     end
     require_privilege(required_role, @permission_object)
     set_permissions_header
diff --git a/src/app/controllers/user_groups_controller.rb b/src/app/controllers/user_groups_controller.rb
index 6cae0fa..23cac12 100644
--- a/src/app/controllers/user_groups_controller.rb
+++ b/src/app/controllers/user_groups_controller.rb
@@ -40,6 +40,7 @@ class UserGroupsController < ApplicationController
     @tab_captions = ['Properties']
     @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
     @members = paginate_collection(@user_group.members, params[:page])
+    add_profile_permissions_inline(@user_group.entity)
     respond_to do |format|
       format.html
       format.js do
@@ -222,7 +223,11 @@ class UserGroupsController < ApplicationController
 
   def load_user_groups
     sort_order = params[:sort_by].nil? ? "name" : params[:sort_by]
-    @user_groups = UserGroup.apply_filters(:preset_filter_id => params[:users_preset_filter], :search_filter => params[:user_groups_search]).order(sort_order)
+    @user_groups = UserGroup.apply_filters(:preset_filter_id =>
+                                           params[:user_groups_preset_filter],
+                                           :search_filter =>
+                                           params[:user_groups_search]).
+      order(sort_order)
   end
 
   def load_headers
@@ -233,4 +238,8 @@ class UserGroupsController < ApplicationController
     ]
   end
 
+  def filter
+    redirect_to_original({"user_groups_preset_filter" => params[:user_groups_preset_filter], "user_groups_search" => params[:user_groups_search]})
+  end
+
 end
diff --git a/src/app/controllers/users_controller.rb b/src/app/controllers/users_controller.rb
index 0b8c3fe..0c9f564 100644
--- a/src/app/controllers/users_controller.rb
+++ b/src/app/controllers/users_controller.rb
@@ -81,6 +81,7 @@ class UsersController < ApplicationController
     save_breadcrumb(user_path(@user), @user.name)
     @tab_captions = ['Properties']
     @details_tab = 'properties' # currently the only supported details tab
+    add_profile_permissions_inline(@user.entity)
     respond_to do |format|
       format.html
       format.js do
diff --git a/src/app/models/common_filter_methods.rb b/src/app/models/common_filter_methods.rb
index 9491ecb..555b20f 100644
--- a/src/app/models/common_filter_methods.rb
+++ b/src/app/models/common_filter_methods.rb
@@ -16,14 +16,17 @@
 #this module contains functions for filtering table data
 module CommonFilterMethods
   def apply_filters(options = {})
-    apply_preset_filter(options[:preset_filter_id]).apply_search_filter(options[:search_filter])
+    filters_options = options[:preset_filters_options] ||
+      self::PRESET_FILTERS_OPTIONS
+    apply_preset_filter(options[:preset_filter_id], filters_options).
+      apply_search_filter(options[:search_filter])
   end
 
   private
 
-  def apply_preset_filter(preset_filter_id)
+  def apply_preset_filter(preset_filter_id, filters_options)
     if preset_filter_id.present?
-      option = self::PRESET_FILTERS_OPTIONS.select { |item|
+      option = filters_options.select { |item|
         item[:id] == preset_filter_id}.first
       if option[:query]
         option[:query]
diff --git a/src/app/models/derived_permission.rb b/src/app/models/derived_permission.rb
index 80d055d..2eb2c78 100644
--- a/src/app/models/derived_permission.rb
+++ b/src/app/models/derived_permission.rb
@@ -69,9 +69,68 @@ class DerivedPermission < ActiveRecord::Base
      :where => {"entities.entity_target_type" => "UserGroup"}}
   ]
 
+  PROFILE_PRESET_FILTERS_OPTIONS = [
+    {:title => "permissions.global",
+     :id => "base_permission_object_permissions",
+     :includes => [:entity, :base_permission_object],
+     :where => {"permission_object_type" => "BasePermissionObject"}},
+    {:title => "activerecord.models.provider",
+     :id => "provider_permissions",
+     :includes => [:entity, :provider],
+     :where => {"permission_object_type" => "Provider"},
+     :search_fields => ["providers.name"]},
+    {:title => "activerecord.models.provider_account",
+     :id => "provider_account_permissions",
+     :includes => [:entity, {:provider_account => :provider}],
+     :where => {"permission_object_type" => "ProviderAccount"},
+     :search_fields => ["provider_accounts.label", "providers.name"]},
+    {:title => "activerecord.models.pool",
+     :id => "pool_permissions",
+     :includes => [:entity, :pool],
+     :where => {"permission_object_type" => "Pool"},
+     :search_fields => ["pools.name"]},
+    {:title => "activerecord.models.pool_family",
+     :id => "pool_family_permissions",
+     :includes => [:entity, :pool_family],
+     :where => {"permission_object_type" => "PoolFamily"},
+     :search_fields => ["pool_families.name"]},
+    {:title => "activerecord.models.catalog",
+     :id => "catalog_permissions",
+     :includes => [:entity, :catalog],
+     :where => {"permission_object_type" => "Catalog"},
+     :search_fields => ["catalogs.name"]},
+    {:title => "activerecord.models.deployable",
+     :id => "deployable_permissions",
+     :includes => [:entity, :deployable],
+     :where => {"permission_object_type" => "Deployable"},
+     :search_fields => ["deployables.name"]},
+    {:title => "activerecord.models.deployment",
+     :id => "deployment_permissions",
+     :includes => [:entity, :deployment],
+     :where => {"permission_object_type" => "Deployment"},
+     :search_fields => ["deployments.name"]},
+    {:title => "activerecord.models.instance",
+     :id => "instance_permissions",
+     :includes => [:entity, :instance],
+     :where => {"permission_object_type" => "Instance"},
+     :search_fields => ["instances.name"]}
+  ]
   def self.apply_search_filter(search)
+    search, preset_filter_id = search
     if search
-      includes("entity").where("lower(entities.name) LIKE :search", :search => "%#{search.downcase}%")
+      if preset_filter_id
+        search_fields = PROFILE_PRESET_FILTERS_OPTIONS.select { |item|
+          item[:id] == preset_filter_id
+        }.first[:search_fields]
+        search_fields = [] if search_fields.nil?
+      else
+        search_fields = []
+      end
+      where_str = "lower(entities.name) LIKE :search OR lower(roles.name) LIKE :search"
+      search_fields.each do |search_field|
+        where_str += " OR lower(#{search_field}) LIKE :search"
+      end
+      includes([:entity, :role]).where(where_str, :search => "%#{search.downcase}%")
     else
       scoped
     end
diff --git a/src/app/models/permission.rb b/src/app/models/permission.rb
index 9b4c0ac..04736e2 100644
--- a/src/app/models/permission.rb
+++ b/src/app/models/permission.rb
@@ -81,6 +81,52 @@ class Permission < ActiveRecord::Base
      :includes => :entity,
      :where => {"entities.entity_target_type" => "UserGroup"}}
   ]
+  PROFILE_PRESET_FILTERS_OPTIONS = [
+    {:title => "permissions.global",
+     :id => "base_permission_object_permissions",
+     :includes => [:entity, :base_permission_object],
+     :where => {"permission_object_type" => "BasePermissionObject"}},
+    {:title => "activerecord.models.provider",
+     :id => "provider_permissions",
+     :includes => [:entity, :provider],
+     :where => {"permission_object_type" => "Provider"},
+     :search_fields => ["providers.name"]},
+    {:title => "activerecord.models.provider_account",
+     :id => "provider_account_permissions",
+     :includes => [:entity, {:provider_account => :provider}],
+     :where => {"permission_object_type" => "ProviderAccount"},
+     :search_fields => ["provider_accounts.label", "providers.name"]},
+    {:title => "activerecord.models.pool",
+     :id => "pool_permissions",
+     :includes => [:entity, :pool],
+     :where => {"permission_object_type" => "Pool"},
+     :search_fields => ["pools.name"]},
+    {:title => "activerecord.models.pool_family",
+     :id => "pool_family_permissions",
+     :includes => [:entity, :pool_family],
+     :where => {"permission_object_type" => "PoolFamily"},
+     :search_fields => ["pool_families.name"]},
+    {:title => "activerecord.models.catalog",
+     :id => "catalog_permissions",
+     :includes => [:entity, :catalog],
+     :where => {"permission_object_type" => "Catalog"},
+     :search_fields => ["catalogs.name"]},
+    {:title => "activerecord.models.deployable",
+     :id => "deployable_permissions",
+     :includes => [:entity, :deployable],
+     :where => {"permission_object_type" => "Deployable"},
+     :search_fields => ["deployables.name"]},
+    {:title => "activerecord.models.deployment",
+     :id => "deployment_permissions",
+     :includes => [:entity, :deployment],
+     :where => {"permission_object_type" => "Deployment"},
+     :search_fields => ["deployments.name"]},
+    {:title => "activerecord.models.instance",
+     :id => "instance_permissions",
+     :includes => [:entity, :instance],
+     :where => {"permission_object_type" => "Instance"},
+     :search_fields => ["instances.name"]}
+  ]
   def user
     entity.user
   end
@@ -116,8 +162,21 @@ class Permission < ActiveRecord::Base
   end
 
   def self.apply_search_filter(search)
+    search, preset_filter_id = search
     if search
-      includes("entity").where("lower(entities.name) LIKE :search", :search => "%#{search.downcase}%")
+      if preset_filter_id
+        search_fields = PROFILE_PRESET_FILTERS_OPTIONS.select { |item|
+          item[:id] == preset_filter_id
+        }.first[:search_fields]
+        search_fields = [] if search_fields.nil?
+      else
+        search_fields = []
+      end
+      where_str = "lower(entities.name) LIKE :search OR lower(roles.name) LIKE :search"
+      search_fields.each do |search_field|
+        where_str += " OR lower(#{search_field}) LIKE :search"
+      end
+      includes([:entity, :role]).where(where_str, :search => "%#{search.downcase}%")
     else
       scoped
     end
diff --git a/src/app/models/role.rb b/src/app/models/role.rb
index dcf3178..2989042 100644
--- a/src/app/models/role.rb
+++ b/src/app/models/role.rb
@@ -47,4 +47,14 @@ class Role < ActiveRecord::Base
   def privilege_target_match(obj_type)
     (privilege_target_types & obj_type.active_privilege_target_types).any?
   end
+
+  def self.all_by_scope
+    roles = self.all
+    role_hash = {}
+    roles.each do |role|
+      role_hash[role.scope] ||= []
+      role_hash[role.scope] << role
+    end
+    role_hash
+  end
 end
diff --git a/src/app/models/user.rb b/src/app/models/user.rb
index 73579e5..7d18223 100644
--- a/src/app/models/user.rb
+++ b/src/app/models/user.rb
@@ -59,7 +59,7 @@ class User < ActiveRecord::Base
   attr_accessor :ignore_password
 
   has_many :permissions, :through => :entity
-  has_many :derived_permissions, :through => :entities
+  has_many :derived_permissions, :through => :entity
   has_many :owned_instances, :class_name => "Instance", :foreign_key => "owner_id"
   has_many :deployments, :foreign_key => "owner_id"
   has_many :view_states
diff --git a/src/app/models/user_group.rb b/src/app/models/user_group.rb
index 3d4513d..9aae611 100644
--- a/src/app/models/user_group.rb
+++ b/src/app/models/user_group.rb
@@ -40,6 +40,11 @@ class UserGroup < ActiveRecord::Base
   validates_inclusion_of :membership_source, :in => MEMBERSHIP_SOURCES
   after_save :update_entity
 
+  PRESET_FILTERS_OPTIONS = [
+    {:title => "user_groups.preset_filters.local", :id => "local_user_groups", :query => where("user_groups.membership_source = ?", MEMBERSHIP_SOURCE_LOCAL)},
+    {:title => "user_groups.preset_filters.ldap", :id => "ldap_user_groups", :query => where("user_groups.membership_source = ?", MEMBERSHIP_SOURCE_LDAP)}
+  ]
+
   def update_entity
     self.entity = Entity.new(:entity_target => self) unless self.entity
     self.entity.name = "#{self.name} (#{self.membership_source})"
diff --git a/src/app/views/permissions/_objects.html.haml b/src/app/views/permissions/_objects.html.haml
new file mode 100644
index 0000000..fd2e143
--- /dev/null
+++ b/src/app/views/permissions/_objects.html.haml
@@ -0,0 +1,62 @@
+- content_for :permissions_form_header do
+  - if not(@show_inherited) && check_privilege(Privilege::PERM_SET)
+    %li= restful_submit_tag t('permissions.revoke_access'), "destroy", multi_destroy_permissions_path, 'DELETE', :id => 'revoke_button', :class => 'button danger'
+    %li= restful_submit_tag t('edit'), "multi_update", multi_update_permissions_path, 'POST', :id => 'perm_edit_button', :class => 'hidden'
+    = hidden_field_tag :entity_id, @entity.id
+
+    = hidden_field_tag :path_prefix, @path_prefix
+    = hidden_field_tag :return_path, url_for(@entity.entity_target)
+    = hidden_field_tag :use_tabs, @use_tabs ? @use_tabs : (@tabs ? 'yes' : 'no')
+  %span{:id => ("tab-container-1-nav" unless @inline)}
+    - if @show_inherited
+      %li= link_to t('permissions.direct_access'), params.merge(:show_inherited => false, :page => 1), { :class => 'button primary', :id => 'direct_permission_button'}
+    - else
+      %li= link_to t('permissions.inherited_access'), params.merge(:show_inherited => true, :page => 1), { :class => 'button primary', :id => 'inherited_permission_button'}
+
+- content_for :permissions_filter_controls do
+  %li
+    = label_tag :profile_permissions_preset_filter, t('filter_table.viewing')
+    = select_tag(:profile_permissions_preset_filter, preset_filters_options_for_select(Permission::PROFILE_PRESET_FILTERS_OPTIONS, params[:profile_permissions_preset_filter]), :include_blank => t("permissions.preset_filters.all_permissions"), :disabled => false)
+    = hidden_field_tag :current_path, request.fullpath
+    = restful_submit_tag t("filter_table.apply_filters"), "profile_filter", profile_filter_permissions_path, 'POST', :class => 'button', :id => 'apply_profile_permissions_preset_filter'
+    %span.label.badge.dark= @permissions.count
+  %li.table-search-filter
+    - disable_search = params[:profile_permissions_preset_filter].nil? || params[:profile_permissions_preset_filter].empty?
+    = text_field_tag :profile_permissions_search, (disable_search ? nil : params[:profile_permissions_search]), :placeholder => t("filter_table.search"), :disabled => disable_search
+    = restful_submit_tag "", "search", profile_filter_permissions_path, 'POST', :class => 'button', :id => 'apply_profile_permissions_search'
+
+  :javascript
+    $(document).ready(function(){
+      $("#apply_profile_permissions_preset_filter").hide();
+      $("#profile_permissions_preset_filter").change(function() {
+        $("#apply_profile_permissions_preset_filter").click();
+      });
+      Conductor.clickOnEnterKeypress($('#profile_permissions_search'), $('#apply_profile_permissions_search'));
+    });
+
+= filter_table(@permission_list_header,
+               @permissions,
+               :form_header => :permissions_form_header,
+               :filter_controls => :permissions_filter_controls) do |permission|
+  %tr{:class => cycle('nostripe','stripe')}
+    - if not(@show_inherited)
+      %td{:class => 'checkbox'}
+        - if check_privilege(Privilege::PERM_SET)
+          - selected = params[:select] == 'all'
+          = check_box_tag "permission_selected[]", permission.id, selected, :id => "permission_checkbox_#{permission.id}"
+    - if permission.permission_object.class == BasePermissionObject
+      %td= t'permissions.global'
+    - else
+      %td= link_to permission.permission_object.name, permission.permission_object
+    - if not(@show_inherited) && check_privilege(Privilege::PERM_SET)
+      %td= select_tag "permission_role_selected[]", options_for_select(@roles[permission.permission_object_type].map {|r| [ t(r.name, :scope=> :role_defs, :default => r.name), "#{permission.id},#{r.id}" ] }, :selected => "#{permission.id},#{permission.role.id}", :disabled => @entity.permissions.where(["entity_id = ? and role_id != ?", permission.entity_id, permission.role_id]).collect {|p| "#{permission.id},#{p.role.id}"}), :id => "permission_role_selected_#{permission.id}"
+      :javascript
+        $("#permission_role_selected_#{permission.id}").change(function () { $("#perm_edit_button").click(); } );
+
+    -else
+      %td= t(permission.role.name, :scope=> :role_defs, :default => permission.role.name)
+    - if @show_inherited
+      - if permission.permission.permission_object.class == BasePermissionObject
+        %td= t'permissions.global'
+      - else
+        %td= link_to permission.permission.permission_object.name, permission.permission.permission_object
diff --git a/src/app/views/user_groups/_list.html.haml b/src/app/views/user_groups/_list.html.haml
index 0f6d2f3..c9af5d7 100644
--- a/src/app/views/user_groups/_list.html.haml
+++ b/src/app/views/user_groups/_list.html.haml
@@ -9,7 +9,7 @@
   %li
     = label_tag :user_groups_preset_filter, t('filter_table.viewing')
     = hidden_field_tag :current_path, request.fullpath
-    = select_tag(:user_groups_preset_filter, preset_filters_options_for_select(User::PRESET_FILTERS_OPTIONS, params[:user_groups_preset_filter]), :include_blank => t("user_groups.preset_filters.all_user_groups"), :disabled => true)
+    = select_tag(:user_groups_preset_filter, preset_filters_options_for_select(UserGroup::PRESET_FILTERS_OPTIONS, params[:user_groups_preset_filter]), :include_blank => t("user_groups.preset_filters.all_user_groups"))
     = restful_submit_tag t("filter_table.apply_filters"), "index", filter_user_groups_path, 'POST', :class => 'button', :id => 'apply_user_groups_preset_filter'
     %span.label.badge.dark= @user_groups.count
   /  = link_to "Filter", "#", :class => 'button pill'
diff --git a/src/app/views/user_groups/show.html.haml b/src/app/views/user_groups/show.html.haml
index cb22930..f5f1890 100644
--- a/src/app/views/user_groups/show.html.haml
+++ b/src/app/views/user_groups/show.html.haml
@@ -69,3 +69,8 @@
             = link_to member.login, users_path(member)
           %td
             = member.name
+%section.content-section.permissions
+  %header
+    %h2.permissions=t'permissions.index.permissions'
+  .content
+    = render :partial => 'permissions/objects'
diff --git a/src/app/views/users/show.html.haml b/src/app/views/users/show.html.haml
index 54ca9e3..a89581d 100644
--- a/src/app/views/users/show.html.haml
+++ b/src/app/views/users/show.html.haml
@@ -44,13 +44,18 @@
             %dt=t'users.show.last_login_ip'
             %dd= @user.last_login_ip
 
-%section.content-section.user
+%section.content-section.groups
   %header
     %h2.groups=t'users.groups'
 = filter_table(@groups_header, @user_groups) do |user_group|
   %tr{:class => cycle('nostripe','stripe')}
     %td= link_to user_group.name, user_group_path(user_group)
     %td= t("user_groups.#{user_group.membership_source.downcase}")
+%section.content-section.permissions
+  %header
+    %h2.permissions=t'permissions.index.permissions'
+  .content
+    = render :partial => 'permissions/objects'
 /%section.content-section.user
 /  %header
 /    %h2.activity Activity
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index 151a84e..2824cf3 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -1340,6 +1340,8 @@ en:
   permissions:
     direct_access: "Direct Access"
     global_access: "Global Access"
+    global: "Global"
+    resource: "Resource"
     inherited_access: "Inherited Access"
     inherited_from: "Inherited From"
     revoke_access: "Revoke Access"
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 119d740..685bbec 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -85,6 +85,7 @@ Conductor::Application.routes.draw do
       post :multi_update
       post :filter
       post :filter_entities
+      post :profile_filter
     end
   end
 
diff --git a/src/features/step_definitions/permission_steps.rb b/src/features/step_definitions/permission_steps.rb
index 8620156..83641d8 100644
--- a/src/features/step_definitions/permission_steps.rb
+++ b/src/features/step_definitions/permission_steps.rb
@@ -35,6 +35,11 @@ Given /^there is a permission for the user "([^\"]*)" on the pool family "([^\"]
                                          :permission_object => PoolFamily.find_by_name(pool_family_name))
 end
 
+Given /^there is a permission for the user group "([^\"]*)" on the pool "([^\"]*)"$/ do |group_name, pool_name|
+  @pool_user_permission = FactoryGirl.create(:pool_user_permission, :entity_id => UserGroup.find_by_name(group_name).entity.id,
+                                         :permission_object => Pool.find_by_name(pool_name))
+end
+
 Given /^I delete the permission$/ do
   check "permission_checkbox_#{@pool_user_permission.id}"
   click_button "revoke_button"
diff --git a/src/features/user.feature b/src/features/user.feature
index 46e0b38..b3bdea9 100644
--- a/src/features/user.feature
+++ b/src/features/user.feature
@@ -33,6 +33,13 @@ Feature: Manage Users
     When I follow "testuser"
     Then I should be on testuser's user page
 
+  Scenario: Show user permissions
+    Given a pool "PermissionPool" exists
+    And there is a permission for the user "testuser" on the pool "PermissionPool"
+    And I am on the users page
+    When I follow "testuser"
+    Then I should see "PermissionPool"
+
   Scenario: Delete users
     Given there is a user "testuser"
     And I am on the users page
diff --git a/src/features/user_group.feature b/src/features/user_group.feature
index 08f4db7..2779469 100644
--- a/src/features/user_group.feature
+++ b/src/features/user_group.feature
@@ -15,6 +15,13 @@ Feature: Manage User Groups
     When I follow "testgroup"
     Then I should be on testgroup's user group page
 
+  Scenario: Show user group permissions
+    Given a pool "PermissionPool" exists
+    And there is a permission for the user group "testgroup" on the pool "PermissionPool"
+    And I am on the user groups page
+    When I follow "testgroup"
+    Then I should see "PermissionPool"
+
   Scenario: Delete user groups
     Given there is a user group "testgroup"
     Given there is a user group "testgroup2"
-- 
1.7.6.5




More information about the aeolus-devel mailing list