From 8e59f59151728aed9dc6d95dd510c623d1cf424a Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Wed, 9 Oct 2013 13:18:07 +0200 Subject: [PATCH] [webui] merge Webui::Role into Role It was just a namespace anyway --- src/api/app/models/role.rb | 6 ++++++ .../webui/app/controllers/webui/group_controller.rb | 2 +- .../app/controllers/webui/package_controller.rb | 6 +++--- .../app/controllers/webui/project_controller.rb | 2 +- .../webui/app/controllers/webui/user_controller.rb | 4 ++-- src/api/webui/app/models/webui/role.rb | 13 ------------- 6 files changed, 13 insertions(+), 20 deletions(-) delete mode 100644 src/api/webui/app/models/webui/role.rb diff --git a/src/api/app/models/role.rb b/src/api/app/models/role.rb index 12dda3ec1a5..94dc9c8086c 100644 --- a/src/api/app/models/role.rb +++ b/src/api/app/models/role.rb @@ -58,6 +58,12 @@ def rolecache def get_by_title(title) find_by_title(title) or raise NotFound.new("Couldn't find Role '#{title}'") end + def local_roles + Array[ "maintainer", "bugowner", "reviewer", "downloader" , "reader"] + end + def global_roles + Array[ "Admin", "User"] + end end def rolecache diff --git a/src/api/webui/app/controllers/webui/group_controller.rb b/src/api/webui/app/controllers/webui/group_controller.rb index 50ef41f86a0..f545f998b5c 100644 --- a/src/api/webui/app/controllers/webui/group_controller.rb +++ b/src/api/webui/app/controllers/webui/group_controller.rb @@ -28,7 +28,7 @@ def add def edit required_parameters :group - @roles = Webui::Role.global_roles + @roles = Role.global_roles @members = [] @displayed_group.person.each do |person | user = { 'name' => person.userid } diff --git a/src/api/webui/app/controllers/webui/package_controller.rb b/src/api/webui/app/controllers/webui/package_controller.rb index 03d847e8db7..20451222450 100644 --- a/src/api/webui/app/controllers/webui/package_controller.rb +++ b/src/api/webui/app/controllers/webui/package_controller.rb @@ -174,7 +174,7 @@ def binaries def users @users = [@project.users, @package.users].flatten.uniq @groups = [@project.groups, @package.groups].flatten.uniq - @roles = Webui::Role.local_roles + @roles = Role.local_roles end def requests @@ -301,11 +301,11 @@ def set_file_details private :set_file_details def add_person - @roles = Webui::Role.local_roles + @roles = Role.local_roles end def add_group - @roles = Webui::Role.local_roles + @roles = Role.local_roles end def rdiff diff --git a/src/api/webui/app/controllers/webui/project_controller.rb b/src/api/webui/app/controllers/webui/project_controller.rb index 1aa1d1adb6a..f64f06f2a72 100644 --- a/src/api/webui/app/controllers/webui/project_controller.rb +++ b/src/api/webui/app/controllers/webui/project_controller.rb @@ -119,7 +119,7 @@ def get_filtered_projectlist(filterstring, excludefilter='', opts={}) def users @users = @project.users @groups = @project.groups - @roles = Webui::Role.local_roles + @roles = Role.local_roles end def subprojects diff --git a/src/api/webui/app/controllers/webui/user_controller.rb b/src/api/webui/app/controllers/webui/user_controller.rb index 6e6c937259e..93682f1ca64 100644 --- a/src/api/webui/app/controllers/webui/user_controller.rb +++ b/src/api/webui/app/controllers/webui/user_controller.rb @@ -72,7 +72,7 @@ def save end def edit - @roles = Webui::Role.global_roles + @roles = Role.global_roles @states = State.states end @@ -113,7 +113,7 @@ def admin end def save_dialog - @roles = Webui::Role.global_roles + @roles = Role.global_roles render_dialog end diff --git a/src/api/webui/app/models/webui/role.rb b/src/api/webui/app/models/webui/role.rb deleted file mode 100644 index 9108f070bfd..00000000000 --- a/src/api/webui/app/models/webui/role.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Webui::Role - - class << self - def local_roles - Array[ "maintainer", "bugowner", "reviewer", "downloader" , "reader"] - end - def global_roles - Array[ "Admin", "User"] - end - - end - -end