Fixed file store access, added builders page in admin section
This commit is contained in:
parent
710d6096ba
commit
1f18eca69c
|
@ -0,0 +1,19 @@
|
||||||
|
ActiveAdmin.register_page 'Builders' do
|
||||||
|
content do
|
||||||
|
table do
|
||||||
|
thead do
|
||||||
|
["id", "system?", "Hostname", "Busy workers", "Supported Arches", "Supported Platforms"].each &method(:th)
|
||||||
|
end
|
||||||
|
tbody do
|
||||||
|
RpmBuildNode.all.to_a.each do |node|
|
||||||
|
next unless node.user_id
|
||||||
|
tr do
|
||||||
|
%w(id system host busy_workers supported_arches supported_platforms).each do |col|
|
||||||
|
td { node.send(col) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -23,6 +23,14 @@ class Api::V1::BaseController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_auth_pw_or_token
|
||||||
|
authenticate_or_request_with_http_basic do |username,pw|
|
||||||
|
if user = User.auth_by_token_or_login_pass(username, pw)
|
||||||
|
sign_in user, false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def set_csv_file_headers(file_name)
|
def set_csv_file_headers(file_name)
|
||||||
headers['Content-Type'] = 'text/csv'
|
headers['Content-Type'] = 'text/csv'
|
||||||
headers['Content-disposition'] = "attachment; filename=\"#{file_name}.csv\""
|
headers['Content-disposition'] = "attachment; filename=\"#{file_name}.csv\""
|
||||||
|
|
|
@ -46,7 +46,10 @@ class Api::V1::JobsController < Api::V1::BaseController
|
||||||
user_id: current_user.id,
|
user_id: current_user.id,
|
||||||
system: current_user.system?,
|
system: current_user.system?,
|
||||||
worker_count: params[:worker_count],
|
worker_count: params[:worker_count],
|
||||||
busy_workers: params[:busy_workers]
|
busy_workers: params[:busy_workers],
|
||||||
|
host: params[:host],
|
||||||
|
supported_arches: params[:supported_arches],
|
||||||
|
supported_platforms: params[:supported_platforms]
|
||||||
) rescue nil
|
) rescue nil
|
||||||
end
|
end
|
||||||
render nothing: true
|
render nothing: true
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
class Api::V1::UsersController < Api::V1::BaseController
|
class Api::V1::UsersController < Api::V1::BaseController
|
||||||
|
|
||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
|
before_action :check_auth_pw_or_token, only: :show_current_user
|
||||||
|
skip_before_action :check_auth, only: :show_current_user
|
||||||
skip_before_action :check_auth, only: [:show] if APP_CONFIG['anonymous_access']
|
skip_before_action :check_auth, only: [:show] if APP_CONFIG['anonymous_access']
|
||||||
skip_before_action :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access']
|
skip_before_action :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access']
|
||||||
before_action :load_user, only: %i(show)
|
before_action :load_user, only: %i(show)
|
||||||
|
|
|
@ -12,6 +12,9 @@ class RpmBuildNode < Ohm::Model
|
||||||
attribute :worker_count
|
attribute :worker_count
|
||||||
attribute :busy_workers
|
attribute :busy_workers
|
||||||
attribute :system
|
attribute :system
|
||||||
|
attribute :host
|
||||||
|
attribute :supported_arches
|
||||||
|
attribute :supported_platforms
|
||||||
|
|
||||||
def user
|
def user
|
||||||
User.where(id: user_id).first
|
User.where(id: user_id).first
|
||||||
|
|
Loading…
Reference in New Issue