diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/build_lists_controller.rb index d6476b809..9132b6ade 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/build_lists_controller.rb @@ -16,7 +16,10 @@ class BuildListsController < ApplicationController @build_lists = BuildList.paginate :page => params[:page] end @action_url = all_build_lists_path - + + @build_server_status = BuildServer.get_status + #@build_server_status = {:client_count => '1', :count_new_task => '2', :count_build_task => 3} + render :action => 'index' end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a06618605..9274de730 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -17,9 +17,13 @@ class UsersController < ApplicationController def new @user = User.new + @global_roles = Role.by_acter(User).by_target(:system) + Role.by_acter(:all).by_target(:system) + @global_roles.map! {|role| [role.name, role.id]} end def edit + @global_roles = Role.by_acter(User).by_target(:system) + Role.by_acter(:all).by_target(:system) + @global_roles.map! {|role| [role.name, role.id]} end def create @@ -34,6 +38,7 @@ class UsersController < ApplicationController end def update + puts params[:user].inspect if @user.update_attributes(params[:user]) flash[:notice] = t('flash.user.saved') redirect_to users_path diff --git a/app/models/user.rb b/app/models/user.rb index ac7a909f6..a9eb71bdc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -30,7 +30,7 @@ class User < ActiveRecord::Base errors.add(:uname, I18n.t('flash.user.group_uname_exists')) if Group.exists? :uname => uname } - attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname + attr_accessible :email, :password, :password_confirmation, :remember_me, :login, :name, :ssh_key, :uname, :global_role_id attr_readonly :uname attr_accessor :login diff --git a/app/views/build_lists/index.html.haml b/app/views/build_lists/index.html.haml index 3805cf804..ffde34897 100644 --- a/app/views/build_lists/index.html.haml +++ b/app/views/build_lists/index.html.haml @@ -6,7 +6,19 @@ %li.active= link_to t("layout.build_lists.all"), project_build_lists_path(@project) .content - + - if controller.action_name == 'all' + .inner + %h2= t('layout.build_lists.build_server_status.header') + .field + %span= t('layout.build_lists.build_server_status.client_count') + ":" + %span= @build_server_status[:client_count] + .field + %span= t('layout.build_lists.build_server_status.count_new_task') + ":" + %span= @build_server_status[:count_new_task] + .field + %span= t('layout.build_lists.build_server_status.count_build_task') + ":" + %span= @build_server_status[:count_build_task] + .inner = render :partial => "build_lists/filter", :action_url => @action_url diff --git a/app/views/users/_form.html.haml b/app/views/users/_form.html.haml index 582af426e..de6222e76 100644 --- a/app/views/users/_form.html.haml +++ b/app/views/users/_form.html.haml @@ -7,6 +7,9 @@ .group = f.label :email, t("activerecord.attributes.user.email"), :class => :label = f.text_field :email, :class => 'text_field' +.group + = f.label :global_role_id, t("activerecord.attributes.user.global_role"), :class => :label + = f.select :global_role_id, options_for_select(@global_roles, @user.global_role_id) .group = f.label :ssh_key, t("activerecord.attributes.user.ssh_key"), :class => :label = f.text_area :ssh_key, :class => 'text_area' diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml index f2876d96c..0ea9ad5fc 100644 --- a/app/views/users/show.html.haml +++ b/app/views/users/show.html.haml @@ -21,6 +21,11 @@ = t("activerecord.attributes.user.email") \: = @user.email + %p + %b + = t("activerecord.attributes.user.global_role") + \: + = @user.global_role.name %p %b = t("activerecord.attributes.user.created_at") diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 1ce5269d6..2e8339dce 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -229,6 +229,12 @@ ru: cancel_successed: 'Сборка отменена.' cancel_failed: 'При отмене сборки произошла ошибка!' + build_server_status: + header: Статус сборочного сервера + client_count: Число клиентов + count_new_task: Число заданий в очереди + count_build_task: Число выполняемых заданий + items: statuses: build_error: ошибка сборки diff --git a/doc/acl/acl_intro.md b/doc/acl/acl_intro.md index 55f8a2fc8..0de8a5f95 100644 --- a/doc/acl/acl_intro.md +++ b/doc/acl/acl_intro.md @@ -314,8 +314,8 @@ API для работы с ACL - `can_perform? (target = :system)` -- может ли `current_user` выполнить текущее действие - - `check_global_rights` -- делает редирект назад, если пользователь вообще - не может совершить текущее действие + - `check_global_access` -- делает редирект назад или на главную, если + пользователь вообще не может совершить текущее действие - `roles_to(object)` -- возвращает список ролей `current_user`-а по отношению к объекту - `rights_to(object)` -- возвращает список прав `current_user`-а по отношению diff --git a/lib/build_server.rb b/lib/build_server.rb index 22993a0e9..8447bcef0 100644 --- a/lib/build_server.rb +++ b/lib/build_server.rb @@ -75,6 +75,10 @@ class BuildServer def self.delete_build_list idlist self.client.call('delete_build_list', idlist) end + + def get_status + self.client.call('get_status') + end def self.freeze platform_name, new_repo_name = nil self.client.call('freeze_platform', platform_name, new_repo_name) diff --git a/lib/ext/active_record/base.rb b/lib/ext/active_record/base.rb index 30e6386a9..71563814e 100644 --- a/lib/ext/active_record/base.rb +++ b/lib/ext/active_record/base.rb @@ -129,7 +129,7 @@ class ActiveRecord::Base h end vis = vis[self.name] - return [] if !vis or vis.empty? + return where('1=2') if !vis or vis.empty? if vis == self::VISIBILITIES return scoped # all else