Mailinglist Archive: yast-devel (152 mails)

< Previous Next >
[yast-devel] Re: [yast-commit] <web-client> master : Prevent crash on missing permission
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Thu, 16 Jul 2009 08:31:06 +0200
  • Message-id: <4A5EC92A.7040600@xxxxxxx>
Klaus KXXmpf wrote:
ref: refs/heads/master
commit befe6e2ab25ac2a8b6117f3d99eb8f859cbb3204
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Wed Jul 15 16:49:51 2009 +0200

Prevent crash on missing permission
---
.../app/controllers/system_time_controller.rb | 2 ++
.../systemtime/app/views/system_time/index.rhtml | 4 +++-
2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/plugins/systemtime/app/controllers/system_time_controller.rb
b/plugins/systemtime/app/controllers/system_time_controller.rb
index 2155aa1..8b6da35 100644
--- a/plugins/systemtime/app/controllers/system_time_controller.rb
+++ b/plugins/systemtime/app/controllers/system_time_controller.rb
@@ -48,6 +48,8 @@ class SystemTimeController < ApplicationController
@systemtime = load_proxy 'org.opensuse.yast.modules.yapi.time'

unless @systemtime
+ flash[:warning] = "No permissions for time module"
+ redirect_to root_path
return false
end

diff --git a/plugins/systemtime/app/views/system_time/index.rhtml
b/plugins/systemtime/app/views/system_time/index.rhtml
index 46fbb96..81fc88c 100644
--- a/plugins/systemtime/app/views/system_time/index.rhtml
+++ b/plugins/systemtime/app/views/system_time/index.rhtml
@@ -23,7 +23,9 @@
<%=_("Region:")%>
</label>
</td>
- <td><%= select_tag "region", options_for_select(@valid, @region.name),
:disabled=> disabled %></td>
+ <% name = @region.name rescue ""
+ @valid = Array.new unless @valid -%>
+ <td><%= select_tag "region", options_for_select(@valid, name),
:disabled => disabled %></td>

</tr>
<tr>

Hi,
this is not correct fix as @systemtime is nil is more case and it is
solved (even with correct flash message) in load_proxy. What is needed
to add is check if is set permissions[:read]...I change this patch to
working version.

--
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast modules language
and time
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages