Class: RoadForest::Utility::GrantList
- Inherits:
-
Interface::RDF
- Object
- Webmachine::Application
- Application
- Interface::RDF
- RoadForest::Utility::GrantList
- Defined in:
- lib/roadforest/interface/utility/grant-list.rb
Instance Attribute Summary
Attributes inherited from Application
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Interface::RDF
#add_child, #add_graph_child, #augment_graph, #copy_interface, #current_graph, #error_data, #etag, #etag_graph, #fill_graph, #graph_update, #payload_focus, #payload_pair, #retrieve, #update
Methods included from Graph::Helpers::Focus
Methods included from Graph::Etagging
#blank_mapped, #etag_from, #sorted_quads
Methods inherited from Application
#canonical_host, #default_content_engine, #dispatcher, #initialize
Constructor Details
This class inherits a constructor from RoadForest::Application
Class Method Details
.path_params ⇒ Object
6 7 8 |
# File 'lib/roadforest/interface/utility/grant-list.rb', line 6 def self.path_params [ :username ] end |
Instance Method Details
#data ⇒ Object
21 22 23 24 25 |
# File 'lib/roadforest/interface/utility/grant-list.rb', line 21 def data entity = Authorization::AuthEntity.new entity.username = params[:username] services.authz.policy.grants_for(entity) end |
#new_graph ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/roadforest/interface/utility/grant-list.rb', line 27 def new_graph perm_route = nil begin perm_route = path_provider.route_for_name(:perm) rescue KeyError end start_focus do |focus| data.each do |grant| if perm_route.nil? focus.add(:af, :grants, grant) else focus.add(:af, :grants, path_provider.url_for(:perm, {:grant_name => grant})) end end end end |
#required_grants(method) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/roadforest/interface/utility/grant-list.rb', line 10 def required_grants(method) if method == "GET" services.authz.build_grants do |grants| grants.add(:is, :name => params[:username]) grants.add(:admin) end else super end end |