Mailinglist Archive: yast-commit (477 mails)

< Previous Next >
[yast-commit] rest-service : branch, master, updated.
  • From: git version control <git@xxxxxxxxxxxxxxxx>
  • Date: Tue, 23 Jun 2009 16:25:35 +0200
  • Message-id: <E1MJ6wJ-0000YB-Kb@xxxxxxxxxxxxxxxx>
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "YaST web service".

The branch, master has been updated
via a0a9aa09a1a59665c786351dfdbf8bd61b80bab3 (commit)
via 2cb5104939fdd542e45ef665aefeb531c0f367a6 (commit)
via 3961d6a0ceff0cbb4079df7e0d5552f0ffd7d73b (commit)
from b867ec75ad3ade2736871b3917085dc3835a4dee (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a0a9aa09a1a59665c786351dfdbf8bd61b80bab3
Author: Josef Reidinger <jreidinger@xxxxxxx>
Date: Tue Jun 23 16:22:23 2009 +0200

add timezone update to backend

commit 2cb5104939fdd542e45ef665aefeb531c0f367a6
Author: Josef Reidinger <jreidinger@xxxxxxx>
Date: Tue Jun 23 14:29:01 2009 +0200

update dbus backend, move policies to yast for YaPI to modules which create
it

commit 3961d6a0ceff0cbb4079df7e0d5552f0ffd7d73b
Author: Josef Reidinger <jreidinger@xxxxxxx>
Date: Tue Jun 23 13:21:48 2009 +0200

adapt to new dbus backend

-----------------------------------------------------------------------

Summary of changes and diff:
.../org.opensuse.yast.modules.yapi.language.policy | 31 ----
.../package/yast2-webservice-language.spec | 9 +-
.../time/app/controllers/systemtimes_controller.rb | 149 ++------------------
plugins/time/app/models/system_time.rb | 43 ------
plugins/time/app/models/systemtime.rb | 87 ++++++++++++
plugins/time/config/resources/system_time.yml | 2 +-
.../package/org.opensuse.yast.system.time.policy | 31 ----
plugins/time/package/yast2-webservice-time.spec | 6 -
8 files changed, 102 insertions(+), 256 deletions(-)
delete mode 100644
plugins/language/package/org.opensuse.yast.modules.yapi.language.policy
delete mode 100644 plugins/time/app/models/system_time.rb
create mode 100644 plugins/time/app/models/systemtime.rb
delete mode 100644 plugins/time/package/org.opensuse.yast.system.time.policy

diff --git
a/plugins/language/package/org.opensuse.yast.modules.yapi.language.policy
b/plugins/language/package/org.opensuse.yast.modules.yapi.language.policy
deleted file mode 100644
index af39472..0000000
--- a/plugins/language/package/org.opensuse.yast.modules.yapi.language.policy
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE policyconfig PUBLIC
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd";>
-<policyconfig>
-
- <vendor>YaST Webservice Project</vendor>
- <vendor_url>http://en.opensuse.org/YAST</vendor_url>
-
-<!--
-Rights for languages
--->
-
- <action id="org.opensuse.yast.modules.yapi.language.read">
- <description>Reading languages settings</description>
- <message>Authentication is required to read languages settings</message>
- <defaults>
- <allow_inactive>no</allow_inactive>
- <allow_active>no</allow_active>
- </defaults>
- </action>
- <action id="org.opensuse.yast.modules.yapi.language.write">
- <description>Writing new language settings</description>
- <message>Authentication is required to edit language settings</message>
- <defaults>
- <allow_inactive>no</allow_inactive>
- <allow_active>no</allow_active>
- </defaults>
- </action>
-
-</policyconfig>
\ No newline at end of file
diff --git a/plugins/language/package/yast2-webservice-language.spec
b/plugins/language/package/yast2-webservice-language.spec
index d818922..93894c1 100644
--- a/plugins/language/package/yast2-webservice-language.spec
+++ b/plugins/language/package/yast2-webservice-language.spec
@@ -19,7 +19,6 @@ Version: 0.0.2
Release: 0
Summary: YaST2 - Webservice - Language
Source: www.tar.bz2
-Source1: org.opensuse.yast.modules.yapi.language.policy
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: rubygem-mocha
@@ -52,10 +51,6 @@ rm -rf nbproject
mkdir -p $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}
cp -a * $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}

-# Policies
-mkdir -p $RPM_BUILD_ROOT/usr/share/PolicyKit/policy
-install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/usr/share/PolicyKit/policy/
-
%clean
rm -rf $RPM_BUILD_ROOT

@@ -82,6 +77,4 @@ rm -rf $RPM_BUILD_ROOT
/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/app
/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config
/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/tasks
-/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/test
-%attr(644,root,root) %config
/usr/share/PolicyKit/policy/org.opensuse.yast.modules.yapi.language.policy
-
+/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/test
\ No newline at end of file
diff --git a/plugins/time/app/controllers/systemtimes_controller.rb
b/plugins/time/app/controllers/systemtimes_controller.rb
index b540706..0ccbc97 100644
--- a/plugins/time/app/controllers/systemtimes_controller.rb
+++ b/plugins/time/app/controllers/systemtimes_controller.rb
@@ -5,100 +5,6 @@ class SystemtimesController < ApplicationController

before_filter :login_required

- def initialize
- require "scr"
- @scr = Scr.instance
- end
-
-#--------------------------------------------------------------------------------
-#
-#local methods
-#
-#--------------------------------------------------------------------------------
-
-#
-# get
-#
-
- def get_validtimezones
- retValue = @scr.execute(["/sbin/yast2", "timezone", "list"])
- return [] if retValue[:exit] != 0
- lines = retValue[:stderr].split "\n"
- ret = []
- lines.each do |l|
- if not l.empty?
- lang = l.split " "
- ret << " " << lang[0] if lang[0]!="Region:"
- end
- end
- ret
- end
-
- def get_is_utc
- cmd = @scr.read(".sysconfig.clock.HWCLOCK")
- case cmd
- when "-u" # is utc
- return true
- when nil # failure
- return nil
- else # no utc
- return false
- end
- end
-
- def get_time
- ret = @scr.execute(["/bin/date"])
- return nil if ret[:exit] != 0
- ret[:stdout]
- end
-
- def get_timezone
- return @scr.read(".sysconfig.clock.TIMEZONE")
- end
-
-#
-# set
-#
-
- def set_is_utc (utc)
- #set hwclock
- if utc
- hwclock = "-u"
- else
- hwclock = "--localtime"
- end
- @scr.write(".sysconfig.clock.HWCLOCK", hwclock)
- end
-
- def set_time (date, time)
- #set time
-# cmd = ["/bin/date", "--set=\"#{date} #{time}\""]
-# logger.debug "SetTime cmd #{cmd.inspect}"
-# @scr.execute(cmd)
- environment = [];
- hwclock = @scr.read(".sysconfig.clock.HWCLOCK");
- timezone = get_timezone
- if ( not timezone.empty? && hwclock!= "--localtime")
- environment = ["TZ=#{timezone}"]
- end
-
- cmd = [ "/sbin/hwclock", "--set", hwclock,
- "--date=\"#{date} #{time}\""]
-
- logger.debug "SetTime cmd #{cmd.inspect}"
- @scr.execute(cmd, environment)
-
- cmd = ["/sbin/hwclock", "--hctosys", hwclock]
-
- logger.debug "SetTime cmd #{cmd.inspect}"
- @scr.execute(cmd)
- end
-
- def set_timezone (timezone)
- #set timezone
- @scr.write(".sysconfig.clock.TIMEZONE",timezone)
- end
-

#--------------------------------------------------------------------------------
#
# actions
@@ -106,31 +12,17 @@ class SystemtimesController < ApplicationController

#--------------------------------------------------------------------------------

def update
- unless permission_check( "org.opensuse.yast.system.time.write")
+ unless permission_check( "org.opensuse.yast.modules.yapi.time.write")
render ErrorResult.error(403, 1, "no permission") and return
end

- @systemtime = SystemTime.new
+ @systemtime = Systemtime.new
if params[:time] != nil
- @systemtime.timezone = params[:time][:timezone]
- @systemtime.is_utc = params[:time][:is_utc]
-# @systemtime.currenttime = params[:time][:currenttime]
-# @systemtime.date = params[:time][:date]
-
- begin
- @systemtime.currenttime =
Time.parse(params[:time][:currenttime]).strftime("%H:%M:%S")
- @systemtime.date =
Time.parse(params[:time][:date]).strftime("%m/%d/%y")
- rescue
- render ErrorResult.error(404, 2, "format error in time or date") and
return
- end
- logger.debug "UPDATED: #{@systemtime.inspect}"
- if @systemtime.timezone.blank? or
- @systemtime.is_utc.nil? # don't use blank? for boolean
- render ErrorResult.error(404, 2, "format or internal error") and return
- end
- set_is_utc @systemtime.is_utc
- set_timezone @systemtime.timezone
- set_time(@systemtime.date, @systemtime.currenttime)
+ root = params[:time]
+ @systemtime.datetime = root[:time]
+ @systemtime.timezone = root[:timezone]
+ @systemtime.utcstatus = root[:utcstatus]
+ @systemtime.save
else
render ErrorResult.error(404, 2, "format or internal error") and return
end
@@ -142,28 +34,13 @@ class SystemtimesController < ApplicationController
end

def show
+
+# unless permission_check( "org.opensuse.yast.modules.yapi.time.read")
+# render ErrorResult.error( 403, 1, "no permission" ) and return
+# end

- @systemtime = SystemTime.new
-
- unless permission_check( "org.opensuse.yast.system.time.read")
- render ErrorResult.error( 403, 1, "no permission" ) and return
- else
- begin
- datetime = Time.parse get_time
- rescue
- render ErrorResult.error( 404, 1, "Cannot parse time information" )
and return
- end
- @systemtime.currenttime = datetime.strftime("%H:%M")
- @systemtime.date = datetime.strftime("%d/%m/%Y")
- @systemtime.is_utc = get_is_utc
- @systemtime.timezone = get_timezone
- @systemtime.validtimezones = get_validtimezones
- if @systemtime.is_utc.nil? # don't use blank? for boolean
- @systemtime.timezone.blank? or
- @systemtime.validtimezones.blank?
- render ErrorResult.error( 404, 1, "Cannot get time information" ) and
return
- end
- end
+ @systemtime = Systemtime.new
+ @systemtime.read

end

diff --git a/plugins/time/app/models/system_time.rb
b/plugins/time/app/models/system_time.rb
deleted file mode 100644
index 601a074..0000000
--- a/plugins/time/app/models/system_time.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-class SystemTime
-
- attr_accessor :currenttime,
- :date,
- :timezone,
- :is_utc,
- :validtimezones
-
- def initialize
- @currenttime = ""
- @date = ""
- @timezone = ""
- @is_utc = false
- @validtimezones = ""
- end
-
- def to_xml( options = {} )
- xml = options[:builder] ||= Builder::XmlMarkup.new(options)
- xml.instruct! unless options[:skip_instruct]
-
- xml.systemtime do
- xml.tag!(:currenttime, @currenttime )
- xml.tag!(:date, @date )
- xml.tag!(:timezone, @timezone )
- xml.tag!(:is_utc, @is_utc, {:type => "boolean"} )
- xml.validtimezones({:type => "array"}) do
- @validtimezones.split( " " ).each do |timezone|
- if not timezone.blank?
- xml.timezone do
- xml.tag!(:id, timezone)
- end
- end
- end
- end
- end
- end
-
- def to_json( options = {} )
- hash = Hash.from_xml(to_xml())
- return hash.to_json
- end
-
-end
diff --git a/plugins/time/app/models/systemtime.rb
b/plugins/time/app/models/systemtime.rb
new file mode 100644
index 0000000..af9e620
--- /dev/null
+++ b/plugins/time/app/models/systemtime.rb
@@ -0,0 +1,87 @@
+class Systemtime
+
+ @@timezones = Array.new()
+
+ attr_accessor :datetime,
+ :timezone,
+ :utcstatus
+
+ private
+ def parse_response(response)
+ @datetime = response["time"]
+ @utcstatus= response["utcstatus"]
+ @timezone = response["timezone"]
+ if response["zones"]
+ @@timezones = response["zones"]
+ end
+ end
+
+ def create_read_question
+ ret = {
+ "timezone" => "true",
+ "utcstatus" => "true",
+ "currenttime" => "true"
+ }
+ ret["zones"]= @@timezones.empty? ? "true" : "false"
+ return ret
+ end
+
+ public
+
+ def initialize
+ end
+
+ def read
+ parse_response YastService.Call("YaPI::TIME::Read",create_read_question)
+ end
+
+ def save
+ settings = {}
+ unless @timezone.nil? or @timezone.empty?
+ settings["timezone"] = @timezone
+ end
+ unless @utcstatus.nil? or @utcstatus.empty?
+ settings["utcstatus"] = @utcstatus
+ end
+ unless @datetime.nil? or @datetime.empty?
+ settings["currenttime"] = @datetime
+ end
+ YastService.Call("YaPI::TIME::Write",settings)
+ end
+
+ def to_xml( options = {} )
+ xml = options[:builder] ||= Builder::XmlMarkup.new(options)
+ xml.instruct! unless options[:skip_instruct]
+
+ xml.systemtime do
+ xml.tag!(:time, @datetime )
+ xml.tag!(:timezone, @timezone )
+ xml.tag!(:utcstatus, @utcstatus )
+ xml.timezones({:type => "array"}) do
+ @@timezones.each do |region|
+ if not region.empty?
+ xml.region do
+ xml.tag!(:name, region["name"])
+ xml.tag!(:central, region["central"])
+ xml.entries({:type => "array"}) do
+ region["entries"].each do |id,name|
+ xml.timezone do
+ xml.tag!(:id, id)
+ xml.tag!(:name, name)
+ end
+ end
+ end
+
+ end
+ end
+ end
+ end
+ end
+ end
+
+ def to_json( options = {} )
+ hash = Hash.from_xml(to_xml())
+ return hash.to_json
+ end
+
+end
diff --git a/plugins/time/config/resources/system_time.yml
b/plugins/time/config/resources/system_time.yml
index 4b4fb62..29cdbd4 100644
--- a/plugins/time/config/resources/system_time.yml
+++ b/plugins/time/config/resources/system_time.yml
@@ -1,4 +1,4 @@
-interface: org.opensuse.yast.system.time
+interface: org.opensuse.yast.modules.yapi.time
controller: systemtimes
singular: true

diff --git a/plugins/time/package/org.opensuse.yast.system.time.policy
b/plugins/time/package/org.opensuse.yast.system.time.policy
deleted file mode 100644
index 35c989c..0000000
--- a/plugins/time/package/org.opensuse.yast.system.time.policy
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE policyconfig PUBLIC
- "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/PolicyKit/1.0/policyconfig.dtd";>
-<policyconfig>
-
- <vendor>YaST Webservice Project</vendor>
- <vendor_url>http://en.opensuse.org/YAST</vendor_url>
-
-<!--
-Rights for system.time
--->
-
- <action id="org.opensuse.yast.system.time.read">
- <description>Reading system time settings</description>
- <message>Authentication is required to read system time settings</message>
- <defaults>
- <allow_inactive>no</allow_inactive>
- <allow_active>no</allow_active>
- </defaults>
- </action>
- <action id="org.opensuse.yast.system.time.write">
- <description>Writing system time settings</description>
- <message>Authentication is required to read system time settings</message>
- <defaults>
- <allow_inactive>no</allow_inactive>
- <allow_active>no</allow_active>
- </defaults>
- </action>
-
-</policyconfig>
\ No newline at end of file
diff --git a/plugins/time/package/yast2-webservice-time.spec
b/plugins/time/package/yast2-webservice-time.spec
index be9d0c5..0118de4 100644
--- a/plugins/time/package/yast2-webservice-time.spec
+++ b/plugins/time/package/yast2-webservice-time.spec
@@ -19,7 +19,6 @@ Version: 0.0.1
Release: 0
Summary: YaST2 - Webservice - Time
Source: www.tar.bz2
-Source1: org.opensuse.yast.system.time.policy
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: rubygem-mocha
@@ -49,10 +48,6 @@ Authors:
mkdir -p $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}
cp -a * $RPM_BUILD_ROOT/srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}

-# Policies
-mkdir -p $RPM_BUILD_ROOT/usr/share/PolicyKit/policy
-install -m 0644 %SOURCE1 $RPM_BUILD_ROOT/usr/share/PolicyKit/policy/
-
%clean
rm -rf $RPM_BUILD_ROOT

@@ -80,5 +75,4 @@ rm -rf $RPM_BUILD_ROOT
%config /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/config
%config /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/tasks
%config /srv/www/%{pkg_user}/vendor/plugins/%{plugin_name}/test
-%attr(644,root,root) %config
/usr/share/PolicyKit/policy/org.opensuse.yast.system.%{plugin_name}.policy



hooks/post-receive
--
YaST web service
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >