Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] <web-client> dmacvicar_log_viewer : Prefer resource.policy to resource.interface for permissions.
  • From: Martin Vidner <mvidner@xxxxxxx>
  • Date: Mon, 24 Aug 2009 15:13:59 +0200
  • Message-id: <E1MlPtx-0006OU-N5@xxxxxxxxxxxxxxxx>
ref: refs/heads/dmacvicar_log_viewer
commit b9cc969707a4743f2292c3f894a4f5bac117bdf3
Author: Martin Vidner <mvidner@xxxxxxx>
Date: Mon Aug 24 15:13:59 2009 +0200

Prefer resource.policy to resource.interface for permissions.

Resources in the network plugin will use it to specify a common
policy for the different interfaces.
---
webclient/lib/yast/service_resource.rb | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/webclient/lib/yast/service_resource.rb
b/webclient/lib/yast/service_resource.rb
index 670cb59..8a1fa31 100644
--- a/webclient/lib/yast/service_resource.rb
+++ b/webclient/lib/yast/service_resource.rb
@@ -146,6 +146,10 @@ module YaST
raise "Can't retrieve permissions. No user specified and not logged
in" if not login

policy_name = nil
+ if self.respond_to? :policy and self.policy
+ policy_name = self.policy
+ end
+
if not policy_name
raise "object does not implement any interface" if not
(self.respond_to?(:interface) and self.interface)
policy_name = self.interface
@@ -188,6 +192,14 @@ module YaST
defined?(@interface) ? @interface : nil
end

+ def policy=(policy_name)
+ @policy = policy_name
+ end
+
+ def policy
+ defined?(@policy) ? @policy : nil
+ end
+
def singular=(singular)
@singular = singular
end
@@ -283,6 +295,11 @@ module YaST
# set the interface name of the proxy
# that is used when retrieving permissions
rsrc.instance_variable_set(:@interface, resource.interface)
+ begin
+ rsrc.instance_variable_set(:@policy, resource.policy)
+ rescue NoMethodError
+ # resource API not updated yet, never mind
+ end
rsrc.instance_variable_set(:@singular, resource.singular?)
rsrc.password = Session.auth_token if not Session.auth_token.blank?

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages