[yast-devel] Re: [yast-commit] <web-client> network : Prefer resource.policy to resource.interface for permissions.
![](https://seccdn.libravatar.org/avatar/d18d0fd84170a8255c30388a800b96c8.jpg?s=120&d=mm&r=g)
* Martin Vidner <mvidner@suse.cz> [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@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (1)
-
Klaus Kaempf