kaui 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +4 -0
- data/app/assets/stylesheets/kaui/datatable.less +4 -0
- data/app/controllers/kaui/accounts_controller.rb +11 -1
- data/app/controllers/kaui/admin_allowed_users_controller.rb +46 -6
- data/app/controllers/kaui/home_controller.rb +1 -1
- data/app/controllers/kaui/payments_controller.rb +4 -3
- data/app/controllers/kaui/role_definitions_controller.rb +20 -0
- data/app/helpers/kaui/payment_helper.rb +11 -0
- data/app/models/kaui/allowed_user.rb +42 -1
- data/app/models/kaui/role_definition.rb +2 -0
- data/app/models/kaui/user_role.rb +8 -0
- data/app/views/kaui/account_timelines/show.html.erb +1 -5
- data/app/views/kaui/accounts/_form.html.erb +8 -0
- data/app/views/kaui/admin_allowed_users/_form.html.erb +17 -2
- data/app/views/kaui/admin_allowed_users/edit.html.erb +10 -0
- data/app/views/kaui/admin_allowed_users/show.html.erb +12 -1
- data/app/views/kaui/admin_tenants/_useful_links.html.erb +1 -1
- data/app/views/kaui/home/index.html.erb +5 -0
- data/app/views/kaui/invoices/index.html.erb +1 -1
- data/app/views/kaui/payments/_payment_table.html.erb +1 -1
- data/app/views/kaui/payments/index.html.erb +2 -1
- data/app/views/kaui/role_definitions/_form.html.erb +20 -0
- data/app/views/kaui/role_definitions/new.html.erb +10 -0
- data/config/routes.rb +3 -1
- data/lib/kaui/version.rb +1 -1
- data/test/functional/kaui/accounts_controller_test.rb +3 -2
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03876ed3f2f539ca41f5d6ae33378309a842c6ba
|
4
|
+
data.tar.gz: 94fc7dd36b710fdaf45c27668b5791d64524914c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8117303c14d31d75080506897654684d52fb44b1d85e4153b626df24b9b89d16ce8cb787329d68c7cff89e65f2e7bb731e785b23e7cfe82707286a45e832a464
|
7
|
+
data.tar.gz: 4b895ba401fb46e454206d26381dbfbcf648520af5e5bcdbdabce0da6cbfbb30386823c557f06edf0eb88e278899ce195cb92af0f060206c82cd55e889afc240
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -100,6 +100,10 @@ Alternatively, you can run the `kaui` script under `bin` by setting your loadpat
|
|
100
100
|
|
101
101
|
ruby -Ilib bin/kaui /path/to/rails/app --path=$PWD --skip-bundle
|
102
102
|
|
103
|
+
Releases
|
104
|
+
========
|
105
|
+
|
106
|
+
The releases are done using Jruby and require the following property `export JRUBY_OPTS='--2.0 -J-Xmx1024m'`
|
103
107
|
|
104
108
|
Multi-Tenancy
|
105
109
|
=============
|
@@ -3,6 +3,16 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
3
3
|
def index
|
4
4
|
@search_query = params[:q]
|
5
5
|
|
6
|
+
if params[:fast] == '1' && !@search_query.blank?
|
7
|
+
account = Kaui::Account.list_or_search(@search_query, -1, 1, options_for_klient).first
|
8
|
+
if account.nil?
|
9
|
+
flash[:error] = "No account matches \"#{@search_query}\""
|
10
|
+
redirect_to kaui_engine.home_path and return
|
11
|
+
else
|
12
|
+
redirect_to kaui_engine.account_path(account.account_id) and return
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
@limit = 50
|
7
17
|
if @search_query.blank?
|
8
18
|
max_nb_records = Kaui::Account.list_or_search(nil, 0, 0, options_for_klient).pagination_max_nb_records
|
@@ -120,7 +130,7 @@ class Kaui::AccountsController < Kaui::EngineController
|
|
120
130
|
@account.is_migrated = @account.is_migrated == '1'
|
121
131
|
@account.is_notified_for_invoices = @account.is_notified_for_invoices == '1'
|
122
132
|
|
123
|
-
@account.update(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
133
|
+
@account.update(true, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
124
134
|
|
125
135
|
redirect_to account_path(@account.account_id), :notice => 'Account successfully updated'
|
126
136
|
rescue => e
|
@@ -8,18 +8,22 @@ class Kaui::AdminAllowedUsersController < Kaui::EngineController
|
|
8
8
|
|
9
9
|
def new
|
10
10
|
@allowed_user = Kaui::AllowedUser.new
|
11
|
+
@roles = []
|
11
12
|
end
|
12
13
|
|
13
14
|
def create
|
14
|
-
|
15
|
+
@allowed_user = Kaui::AllowedUser.new(allowed_user_params)
|
15
16
|
|
16
|
-
existing_user = Kaui::AllowedUser.find_by_kb_username(
|
17
|
+
existing_user = Kaui::AllowedUser.find_by_kb_username(@allowed_user.kb_username)
|
17
18
|
if existing_user
|
18
|
-
flash[:error] = "User with name #{
|
19
|
-
|
19
|
+
flash[:error] = "User with name #{@allowed_user.kb_username} already exists!"
|
20
|
+
render :new and return
|
20
21
|
else
|
21
|
-
|
22
|
-
|
22
|
+
roles = params[:roles].split(',')
|
23
|
+
|
24
|
+
# Create locally and in KB
|
25
|
+
@allowed_user.create_in_kb!(params.require(:password), roles, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
26
|
+
redirect_to kaui_engine.admin_allowed_user_path(@allowed_user.id), :notice => 'User was successfully configured'
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
@@ -27,10 +31,46 @@ class Kaui::AdminAllowedUsersController < Kaui::EngineController
|
|
27
31
|
@allowed_user = Kaui::AllowedUser.find(params.require(:id))
|
28
32
|
raise ActiveRecord::RecordNotFound.new("Could not find user #{@allowed_user.id}") unless (current_user.root? || @allowed_user.kb_username == current_user.kb_username)
|
29
33
|
|
34
|
+
@roles = Kaui::UserRole.find_roles_by_username(@allowed_user.kb_username, options_for_klient).map(&:presence).compact || []
|
35
|
+
|
30
36
|
tenants_for_current_user = retrieve_tenants_for_current_user
|
31
37
|
@tenants = Kaui::Tenant.all.select { |tenant| tenants_for_current_user.include?(tenant.kb_tenant_id) }
|
32
38
|
end
|
33
39
|
|
40
|
+
def edit
|
41
|
+
@allowed_user = Kaui::AllowedUser.find(params.require(:id))
|
42
|
+
|
43
|
+
@roles = Kaui::UserRole.find_roles_by_username(@allowed_user.kb_username, options_for_klient).map(&:presence).compact || []
|
44
|
+
end
|
45
|
+
|
46
|
+
def update
|
47
|
+
@allowed_user = Kaui::AllowedUser.find(params.require(:id))
|
48
|
+
|
49
|
+
@allowed_user.description = params[:allowed_user][:description].presence
|
50
|
+
|
51
|
+
@allowed_user.update_in_kb!(params[:password].presence,
|
52
|
+
params[:roles].presence.split(','),
|
53
|
+
current_user.kb_username,
|
54
|
+
params[:reason],
|
55
|
+
params[:comment],
|
56
|
+
options_for_klient)
|
57
|
+
|
58
|
+
redirect_to kaui_engine.admin_allowed_user_path(@allowed_user.id), :notice => 'User was successfully updated'
|
59
|
+
end
|
60
|
+
|
61
|
+
def destroy
|
62
|
+
allowed_user = Kaui::AllowedUser.find(params.require(:id))
|
63
|
+
|
64
|
+
if allowed_user
|
65
|
+
# Delete locally and in KB
|
66
|
+
allowed_user.destroy_in_kb!(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
67
|
+
redirect_to kaui_engine.admin_allowed_users_path, :notice => 'User was successfully deleted'
|
68
|
+
else
|
69
|
+
flash[:error] = "User #{params.require(:id)} not found"
|
70
|
+
redirect_to kaui_engine.admin_allowed_users_path
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
34
74
|
def add_tenant
|
35
75
|
allowed_user = Kaui::AllowedUser.find(params.require(:allowed_user).require(:id))
|
36
76
|
|
@@ -13,7 +13,7 @@ class Kaui::HomeController < Kaui::EngineController
|
|
13
13
|
elsif search_type == 'transaction'
|
14
14
|
redirect_to transaction_path(:id => search_query)
|
15
15
|
else
|
16
|
-
redirect_to accounts_path(:q => search_query)
|
16
|
+
redirect_to accounts_path(:q => search_query, :fast => params[:fast])
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -26,7 +26,6 @@ class Kaui::PaymentsController < Kaui::EngineController
|
|
26
26
|
'_' + search_key
|
27
27
|
end
|
28
28
|
payments = Kaui::Payment.list_or_search(payment_state, offset, limit, options_for_klient)
|
29
|
-
payments.reject! { |payment| payment.transactions[-1].status != search_key }
|
30
29
|
else
|
31
30
|
account = Kaui::Account::find_by_id_or_key(search_key, false, false, options_for_klient) rescue nil
|
32
31
|
if account.nil?
|
@@ -55,7 +54,8 @@ class Kaui::PaymentsController < Kaui::EngineController
|
|
55
54
|
payment.payment_number.to_i,
|
56
55
|
payment.payment_date,
|
57
56
|
payment.paid_amount_to_money,
|
58
|
-
payment.returned_amount_to_money
|
57
|
+
payment.returned_amount_to_money,
|
58
|
+
payment.transactions.empty? ? nil : payment.transactions[-1].status
|
59
59
|
][column]
|
60
60
|
end
|
61
61
|
|
@@ -64,7 +64,8 @@ class Kaui::PaymentsController < Kaui::EngineController
|
|
64
64
|
view_context.link_to(payment.payment_number, view_context.url_for(:controller => :payments, :action => :show, :account_id => payment.account_id, :id => payment.payment_id)),
|
65
65
|
view_context.format_date(payment.payment_date),
|
66
66
|
view_context.humanized_money_with_symbol(payment.paid_amount_to_money),
|
67
|
-
view_context.humanized_money_with_symbol(payment.returned_amount_to_money)
|
67
|
+
view_context.humanized_money_with_symbol(payment.returned_amount_to_money),
|
68
|
+
payment.transactions.empty? ? nil : view_context.colored_transaction_status(payment.transactions[-1].status)
|
68
69
|
]
|
69
70
|
end
|
70
71
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Kaui::RoleDefinitionsController < Kaui::EngineController
|
2
|
+
|
3
|
+
def new
|
4
|
+
@role_definition = Kaui::RoleDefinition.new
|
5
|
+
end
|
6
|
+
|
7
|
+
def create
|
8
|
+
# Sanity is done on the server side
|
9
|
+
@role_definition = Kaui::RoleDefinition.new(params.require(:role_definition))
|
10
|
+
@role_definition.permissions = @role_definition.permissions.split(',')
|
11
|
+
|
12
|
+
begin
|
13
|
+
@role_definition = @role_definition.create(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
14
|
+
redirect_to admin_allowed_users_path, :notice => 'Role was successfully created'
|
15
|
+
rescue => e
|
16
|
+
flash.now[:error] = "Error while creating role: #{as_string(e)}"
|
17
|
+
render :action => :new
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -5,5 +5,16 @@ module Kaui
|
|
5
5
|
Kaui::Payment::TRANSACTION_STATUSES
|
6
6
|
end
|
7
7
|
|
8
|
+
def colored_transaction_status(transaction_status)
|
9
|
+
data = "<span class='alert-"
|
10
|
+
if transaction_status != 'SUCCESS'
|
11
|
+
data += "danger'>"
|
12
|
+
else
|
13
|
+
data += "success'>"
|
14
|
+
end
|
15
|
+
data += transaction_status
|
16
|
+
data += '</span>'
|
17
|
+
data.html_safe
|
18
|
+
end
|
8
19
|
end
|
9
20
|
end
|
@@ -10,16 +10,57 @@ module Kaui
|
|
10
10
|
:through => :kaui_allowed_user_tenants,
|
11
11
|
:source => :kaui_tenant
|
12
12
|
|
13
|
+
# Create the user locally and in Kill Bill (if needed)
|
13
14
|
def create_in_kb!(password, roles = [], user = nil, reason = nil, comment = nil, options = {})
|
14
15
|
# Create in Kill Bill
|
15
16
|
kb_user = KillBillClient::Model::UserRoles.new
|
16
17
|
kb_user.username = kb_username
|
17
18
|
kb_user.password = password
|
18
19
|
kb_user.roles = roles
|
19
|
-
|
20
|
+
|
21
|
+
begin
|
22
|
+
kb_user.create(user, reason, comment, options)
|
23
|
+
rescue KillBillClient::API::BadRequest => e
|
24
|
+
error_code = JSON.parse(e.response.body)['code'] rescue nil
|
25
|
+
raise e unless error_code == 40002 # SECURITY_USER_ALREADY_EXISTS
|
26
|
+
end
|
20
27
|
|
21
28
|
# Save locally
|
22
29
|
save!
|
23
30
|
end
|
31
|
+
|
32
|
+
# Update the user locally and in Kill Bill (if needed)
|
33
|
+
def update_in_kb!(password, roles, user = nil, reason = nil, comment = nil, options = {})
|
34
|
+
user_role = KillBillClient::Model::UserRoles.new
|
35
|
+
user_role.username = kb_username
|
36
|
+
|
37
|
+
# We have two different APIs to update password and roles
|
38
|
+
unless password.nil?
|
39
|
+
user_role.password = password
|
40
|
+
user_role.update(user, reason, comment, options)
|
41
|
+
user_role.password = nil
|
42
|
+
end
|
43
|
+
unless roles.nil?
|
44
|
+
user_role.roles = roles
|
45
|
+
user_role.update(user, reason, comment, options)
|
46
|
+
end
|
47
|
+
|
48
|
+
save!
|
49
|
+
end
|
50
|
+
|
51
|
+
# Delete the user locally and in Kill Bill (if needed)
|
52
|
+
def destroy_in_kb!(user = nil, reason = nil, comment = nil, options = {})
|
53
|
+
user_role = KillBillClient::Model::UserRoles.new
|
54
|
+
user_role.username = kb_username
|
55
|
+
|
56
|
+
begin
|
57
|
+
user_role.destroy(user, reason, comment, options)
|
58
|
+
rescue KillBillClient::API::BadRequest => e
|
59
|
+
# User already deactivated in Kill Bill
|
60
|
+
end
|
61
|
+
|
62
|
+
# Destroy locally
|
63
|
+
destroy!
|
64
|
+
end
|
24
65
|
end
|
25
66
|
end
|
@@ -129,11 +129,7 @@
|
|
129
129
|
(<%= transaction.currency %>)
|
130
130
|
</li>
|
131
131
|
<li>
|
132
|
-
|
133
|
-
<% if transaction.status != 'SUCCESS' %>class="alert-danger"
|
134
|
-
<% else %>class="alert-success" <% end %>>
|
135
|
-
<%= transaction.status %>
|
136
|
-
</span>
|
132
|
+
<%= colored_transaction_status(transaction.status) %>
|
137
133
|
</li>
|
138
134
|
<li><%= 'Payment #' %> <%= link_to payment.payment_number, account_payment_path(payment.account_id, payment.payment_id) %></li>
|
139
135
|
<% unless invoice.nil? %>
|
@@ -19,6 +19,8 @@
|
|
19
19
|
<%= f.text_field :external_key, :class => 'form-control' %>
|
20
20
|
</div>
|
21
21
|
</div>
|
22
|
+
<% else %>
|
23
|
+
<%= f.hidden_field :external_key %>
|
22
24
|
<% end %>
|
23
25
|
<div class="form-group">
|
24
26
|
<%= f.label :email, 'Email', :class => 'col-sm-3 control-label' %>
|
@@ -45,6 +47,10 @@
|
|
45
47
|
<%= f.collection_select :time_zone, ActiveSupport::TimeZone.all, :formatted_offset, :to_s, {:selected => Time.zone.formatted_offset}, :class => 'form-control' %>
|
46
48
|
</div>
|
47
49
|
</div>
|
50
|
+
<% else %>
|
51
|
+
<%= f.hidden_field :bill_cycle_day_local %>
|
52
|
+
<%= f.hidden_field :currency %>
|
53
|
+
<%= f.hidden_field :time_zone %>
|
48
54
|
<% end %>
|
49
55
|
<div class="form-group">
|
50
56
|
<%= f.label :locale, 'Locale', :class => 'col-sm-3 control-label' %>
|
@@ -116,6 +122,8 @@
|
|
116
122
|
</div>
|
117
123
|
</div>
|
118
124
|
</div>
|
125
|
+
<% else %>
|
126
|
+
<%= f.hidden_field :is_migrated %>
|
119
127
|
<% end %>
|
120
128
|
<div class="form-group">
|
121
129
|
<div class="col-sm-offset-3 col-sm-9">
|
@@ -1,8 +1,15 @@
|
|
1
|
-
|
1
|
+
<% # Unclear why this url/method hack is needed %>
|
2
|
+
<%= form_for @allowed_user, :url => @allowed_user.persisted? ? admin_allowed_user_path(@allowed_user.id) : admin_allowed_users_path, :method => @allowed_user.persisted? ? :put : :post, :html => {:class => 'form-horizontal'} do |f| %>
|
2
3
|
<div class="form-group">
|
3
4
|
<%= f.label :kb_username, 'Name', :class => 'col-sm-2 control-label' %>
|
4
5
|
<div class="col-sm-10">
|
5
|
-
<%= f.text_field :kb_username, :class => 'form-control', :required => true %>
|
6
|
+
<%= f.text_field :kb_username, :class => 'form-control', :required => true, :disabled => @allowed_user.persisted?, :readonly => @allowed_user.persisted? %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div class="form-group">
|
10
|
+
<%= f.label_tag :password, 'Password', :class => 'col-sm-2 control-label' %>
|
11
|
+
<div class="col-sm-10">
|
12
|
+
<%= f.password_field_tag :password, '', :class => 'form-control' %>
|
6
13
|
</div>
|
7
14
|
</div>
|
8
15
|
<div class="form-group">
|
@@ -11,6 +18,14 @@
|
|
11
18
|
<%= f.text_field :description, :class => 'form-control' %>
|
12
19
|
</div>
|
13
20
|
</div>
|
21
|
+
<div class="form-group">
|
22
|
+
<%= label_tag :roles, 'Roles', :class => 'col-sm-2 control-label' %>
|
23
|
+
<div class="col-sm-10">
|
24
|
+
<%= text_field_tag :roles, @roles.join(','), :class => 'form-control' %>
|
25
|
+
<p class="help-block">Comma separated, e.g. customer_support,finance.</p>
|
26
|
+
<p class="help-block">Create a new role <%= link_to 'here', new_role_definition_path %>.</p>
|
27
|
+
</div>
|
28
|
+
</div>
|
14
29
|
<div class="form-group">
|
15
30
|
<div class="col-sm-offset-2 col-sm-10">
|
16
31
|
<%= f.submit 'Save', :class => 'btn btn-default' %>
|
@@ -1,10 +1,21 @@
|
|
1
1
|
<div class="column-block">
|
2
2
|
|
3
|
-
<h1>User details
|
3
|
+
<h1>User details
|
4
|
+
<%= link_to 'Edit',
|
5
|
+
kaui_engine.edit_admin_allowed_user_path(@allowed_user.id),
|
6
|
+
:class => 'btn btn-xs' %>
|
7
|
+
|
8
|
+
<%= link_to '<i class="fa fa-times"></i>'.html_safe,
|
9
|
+
kaui_engine.admin_allowed_user_path(@allowed_user.id),
|
10
|
+
:method => :delete,
|
11
|
+
data: {:confirm => 'Are you sure?'} -%>
|
12
|
+
</h1>
|
4
13
|
|
5
14
|
<b>Name:</b> <%= @allowed_user.kb_username %>
|
6
15
|
<br/>
|
7
16
|
<b>Description:</b> <%= @allowed_user.description %>
|
17
|
+
<br/>
|
18
|
+
<b>Roles:</b> <%= @roles.join(',') %>
|
8
19
|
|
9
20
|
</div>
|
10
21
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<li><%= link_to 'AUTO_INVOICING_OFF accounts', kaui_engine.tags_path(:q => 'AUTO_INVOICING_OFF') %></li>
|
10
10
|
<li><%= link_to 'AUTO_PAY_OFF accounts', kaui_engine.tags_path(:q => 'AUTO_PAY_OFF') %></li>
|
11
11
|
<li><%= link_to 'PENDING payments', kaui_engine.payments_path(:q => 'PENDING') %></li>
|
12
|
-
<li><%= link_to 'UNKNOWN payments', kaui_engine.payments_path(:q => 'UNKNOWN') %></li>
|
12
|
+
<li><%= link_to 'UNKNOWN and PLUGIN_FAILURE payments', kaui_engine.payments_path(:q => 'UNKNOWN') %></li>
|
13
13
|
<li><%= link_to 'Queues', kaui_engine.queues_path %></li>
|
14
14
|
</ul>
|
15
15
|
|
@@ -5,6 +5,11 @@
|
|
5
5
|
<%= form_tag search_path, :id => 'home_searchform', :method => 'get' do %>
|
6
6
|
<%= text_field_tag :q, @search_query, :id => 'search', :placeholder => 'What are you looking for?' %>
|
7
7
|
<%= submit_tag 'Search' %>
|
8
|
+
<div class="checkbox">
|
9
|
+
<%= label_tag :fast do %>
|
10
|
+
<%= check_box_tag :fast %>Fast search (find first exact match)
|
11
|
+
<% end %>
|
12
|
+
</div>
|
8
13
|
<% end %>
|
9
14
|
|
10
15
|
</div>
|
@@ -27,7 +27,7 @@
|
|
27
27
|
<%= javascript_tag do %>
|
28
28
|
$(document).ready(function() {
|
29
29
|
$('#invoices-table').dataTable({
|
30
|
-
<% if @
|
30
|
+
<% if @account.account_id.blank? %>
|
31
31
|
"dom": "<'row'r>t<'row'<'col-md-6'i><'col-md-6'p>>",
|
32
32
|
"pagingType": "full_numbers",
|
33
33
|
"pageLength": <%= @limit %>,
|
@@ -96,7 +96,7 @@
|
|
96
96
|
<td>
|
97
97
|
<ul style="list-style: none; padding-left: 0">
|
98
98
|
<li>
|
99
|
-
|
99
|
+
<%= colored_transaction_status(transaction.status) %>
|
100
100
|
<% if current_user.root? %>
|
101
101
|
<%= link_to ' <i class="fa fa-eraser"></i>'.html_safe, kaui_engine.new_account_transaction_path(payment.account_id,
|
102
102
|
:payment_id => payment.payment_id,
|
@@ -11,6 +11,7 @@
|
|
11
11
|
<th>Date</th>
|
12
12
|
<th>Amount</th>
|
13
13
|
<th>Refund amount</th>
|
14
|
+
<th>Last transaction status</th>
|
14
15
|
</tr>
|
15
16
|
</thead>
|
16
17
|
<tbody>
|
@@ -27,7 +28,7 @@
|
|
27
28
|
<%= javascript_tag do %>
|
28
29
|
$(document).ready(function() {
|
29
30
|
$('#payments-table').dataTable({
|
30
|
-
<% if @
|
31
|
+
<% if @account.account_id.blank? %>
|
31
32
|
"dom": "<'row'r>t<'row'<'col-md-6'i><'col-md-6'p>>",
|
32
33
|
"pagingType": "full_numbers",
|
33
34
|
"pageLength": <%= @limit %>,
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<%= form_for @role_definition, :html => {:class => 'form-horizontal'} do |f| %>
|
2
|
+
<div class="form-group">
|
3
|
+
<%= f.label :role, 'Role name', :class => 'col-sm-3 control-label' %>
|
4
|
+
<div class="col-sm-9">
|
5
|
+
<%= f.text_field :role, :class => 'form-control' %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class="form-group">
|
9
|
+
<%= f.label :permissions, 'Permissions', :class => 'col-sm-3 control-label' %>
|
10
|
+
<div class="col-sm-9">
|
11
|
+
<%= f.text_field :permissions, :class => 'form-control' %>
|
12
|
+
<p class="help-block">Comma separated, e.g. account:create,entitlement:change_plan,invoice:credit</p>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<div class="form-group">
|
16
|
+
<div class="col-sm-offset-3 col-sm-9">
|
17
|
+
<%= submit_tag 'Save', :class => 'btn btn-default' %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -153,8 +153,10 @@ Kaui::Engine.routes.draw do
|
|
153
153
|
match '/remove_allowed_user' => 'admin_tenants#remove_allowed_user', :via => :delete, :as => 'remove_allowed_user'
|
154
154
|
end
|
155
155
|
|
156
|
-
resources :admin_allowed_users
|
156
|
+
resources :admin_allowed_users
|
157
157
|
scope '/admin_allowed_users' do
|
158
158
|
match '/add_tenant' => 'admin_allowed_users#add_tenant', :via => :post, :as => 'add_tenant'
|
159
159
|
end
|
160
|
+
|
161
|
+
resources :role_definitions, :only => [ :new, :create ]
|
160
162
|
end
|
data/lib/kaui/version.rb
CHANGED
@@ -77,12 +77,13 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
|
|
77
77
|
assert_response 200
|
78
78
|
assert_not_nil assigns(:account)
|
79
79
|
|
80
|
+
latest_account_attributes = assigns(:account).to_hash
|
80
81
|
put :update,
|
81
82
|
:account_id => @account.account_id,
|
82
|
-
:account => {
|
83
|
+
:account => latest_account_attributes.merge({
|
83
84
|
:name => SecureRandom.uuid.to_s,
|
84
85
|
:email => SecureRandom.uuid.to_s + '@example.com'
|
85
|
-
}
|
86
|
+
})
|
86
87
|
assert_redirected_to account_path(assigns(:account).account_id)
|
87
88
|
assert_equal 'Account successfully updated', flash[:notice]
|
88
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Killbill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -474,6 +474,7 @@ files:
|
|
474
474
|
- app/controllers/kaui/queues_controller.rb
|
475
475
|
- app/controllers/kaui/refunds_controller.rb
|
476
476
|
- app/controllers/kaui/registrations_controller.rb
|
477
|
+
- app/controllers/kaui/role_definitions_controller.rb
|
477
478
|
- app/controllers/kaui/sessions_controller.rb
|
478
479
|
- app/controllers/kaui/subscriptions_controller.rb
|
479
480
|
- app/controllers/kaui/tag_definitions_controller.rb
|
@@ -516,6 +517,7 @@ files:
|
|
516
517
|
- app/models/kaui/payment_state.rb
|
517
518
|
- app/models/kaui/rails_methods.rb
|
518
519
|
- app/models/kaui/refund.rb
|
520
|
+
- app/models/kaui/role_definition.rb
|
519
521
|
- app/models/kaui/simple_plan.rb
|
520
522
|
- app/models/kaui/subscription.rb
|
521
523
|
- app/models/kaui/tag.rb
|
@@ -523,6 +525,7 @@ files:
|
|
523
525
|
- app/models/kaui/tenant.rb
|
524
526
|
- app/models/kaui/transaction.rb
|
525
527
|
- app/models/kaui/user.rb
|
528
|
+
- app/models/kaui/user_role.rb
|
526
529
|
- app/views/kaui/account_emails/_account_emails_table.html.erb
|
527
530
|
- app/views/kaui/account_emails/_form.html.erb
|
528
531
|
- app/views/kaui/account_emails/new.html.erb
|
@@ -541,6 +544,7 @@ files:
|
|
541
544
|
- app/views/kaui/admin/index.html.erb
|
542
545
|
- app/views/kaui/admin/index.js.erb
|
543
546
|
- app/views/kaui/admin_allowed_users/_form.html.erb
|
547
|
+
- app/views/kaui/admin_allowed_users/edit.html.erb
|
544
548
|
- app/views/kaui/admin_allowed_users/index.html.erb
|
545
549
|
- app/views/kaui/admin_allowed_users/new.html.erb
|
546
550
|
- app/views/kaui/admin_allowed_users/show.html.erb
|
@@ -603,6 +607,8 @@ files:
|
|
603
607
|
- app/views/kaui/refunds/new.html.erb
|
604
608
|
- app/views/kaui/registrations/_form.html.erb
|
605
609
|
- app/views/kaui/registrations/new.html.erb
|
610
|
+
- app/views/kaui/role_definitions/_form.html.erb
|
611
|
+
- app/views/kaui/role_definitions/new.html.erb
|
606
612
|
- app/views/kaui/sessions/_form.html.erb
|
607
613
|
- app/views/kaui/sessions/new.html.erb
|
608
614
|
- app/views/kaui/subscriptions/_edit_form.html.erb
|