Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
[yast-devel] Re: [yast-commit] <web-client> network : Prefer resource.policy to resource.interface for permissions.
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Mon, 24 Aug 2009 16:16:11 +0200
  • Message-id: <20090824141611.GA27717@xxxxxxxxxxxxx>
* Martin Vidner <mvidner@xxxxxxx> [Aug 24. 2009 15:52]:

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

This test shouldn't be needed as you're implementing 'policy' in the
same controller.

+ 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

Just do an "attr_reader :policy". The policy attribute will default to
'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)

This just doesn't look familiar and the Ruby documentation for
instance_variable_set seems to discourage its use.

What are you trying to achieve here ?


Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

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

< Previous Next >
This Thread
  • No further messages