Mailinglist Archive: yast-commit (1828 mails)

< Previous Next >
[yast-commit] <rest-service> master : Added an optional policy field to resource configs.
  • From: Martin Vidner <mvidner@xxxxxxx>
  • Date: Mon, 24 Aug 2009 15:24:16 +0200
  • Message-id: <E1MjUOh-0001B9-UB@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit cbac9b70d0a6677ed5505a7ca4462a766cf9ed7c
Author: Martin Vidner <mvidner@xxxxxxx>
Date: Mon Aug 24 15:24:16 2009 +0200

Added an optional policy field to resource configs.

It means which permission whould be checked.
If it is empty, the proxy code should use interface instead, as
before.
Resources in the network plugin use it to specify a common
policy for the different interfaces.
---
plugins/network/config/resources/hostname.yml | 1 +
plugins/network/config/resources/interfaces.yml | 1 +
plugins/network/config/resources/routes.yml | 1 +
webservice/app/views/resources/index.xml.erb | 1 +
webservice/lib/resource_registration.rb | 5 ++++-
5 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/plugins/network/config/resources/hostname.yml
b/plugins/network/config/resources/hostname.yml
index 4c51233..b838e74 100644
--- a/plugins/network/config/resources/hostname.yml
+++ b/plugins/network/config/resources/hostname.yml
@@ -1,3 +1,4 @@
interface: org.opensuse.yast.modules.yapi.network.hostname
+policy: org.opensuse.yast.modules.yapi.network
controller: network/hostname
singular: true
diff --git a/plugins/network/config/resources/interfaces.yml
b/plugins/network/config/resources/interfaces.yml
index c3b0f62..877f82a 100644
--- a/plugins/network/config/resources/interfaces.yml
+++ b/plugins/network/config/resources/interfaces.yml
@@ -1,2 +1,3 @@
interface: org.opensuse.yast.modules.yapi.network.interfaces
+policy: org.opensuse.yast.modules.yapi.network
controller: network/interfaces
diff --git a/plugins/network/config/resources/routes.yml
b/plugins/network/config/resources/routes.yml
index bfda187..09c08d5 100644
--- a/plugins/network/config/resources/routes.yml
+++ b/plugins/network/config/resources/routes.yml
@@ -1,2 +1,3 @@
interface: org.opensuse.yast.modules.yapi.network.routes
+policy: org.opensuse.yast.modules.yapi.network
controller: network/routes
diff --git a/webservice/app/views/resources/index.xml.erb
b/webservice/app/views/resources/index.xml.erb
index 0525867..b641709 100644
--- a/webservice/app/views/resources/index.xml.erb
+++ b/webservice/app/views/resources/index.xml.erb
@@ -5,6 +5,7 @@
controller = implementation[:controller] -%>
<resource>
<interface><%= interface %></interface>
+ <policy><%= implementation[:policy] %></policy>
<singular type="boolean"><%= implementation[:singular].to_s %></singular>
<href><%= url_for :only_path => true, :controller => controller, :action
=> action -%></href>
</resource>
diff --git a/webservice/lib/resource_registration.rb
b/webservice/lib/resource_registration.rb
index 8978225..92a0c0d 100644
--- a/webservice/lib/resource_registration.rb
+++ b/webservice/lib/resource_registration.rb
@@ -56,6 +56,9 @@ public
error "#{file} does not specify controller" unless controller
# error "#{file}: controller is not a path name" unless controller =~
%r{((\w+)/)+(\w+)}

+ # policy: is optional, interface is used otherwise
+ policy = resource["policy"]
+
# singular: is optional, defaults to false
singular = resource["singular"] || false

@@ -66,7 +69,7 @@ public
error "#{file}: singular resources don't support nested" if singular and
nested

resources[interface] ||= Array.new
- resources[interface] << { :controller => controller, :singular =>
singular, :nested => nested }
+ resources[interface] << { :controller => controller, :singular =>
singular, :nested => nested, :policy => policy }
end

# register routes from a plugin
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages