bullet_train-api 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/account/platform/access_tokens_controller.rb +76 -0
- data/app/controllers/account/platform/applications_controller.rb +2 -5
- data/app/controllers/api/v1/platform/access_tokens_controller.rb +53 -0
- data/app/controllers/concerns/api/controllers/base.rb +1 -0
- data/app/models/platform/access_token.rb +32 -0
- data/app/models/platform/application.rb +5 -0
- data/app/views/account/platform/access_tokens/_breadcrumbs.html.erb +8 -0
- data/app/views/account/platform/access_tokens/_form.html.erb +18 -0
- data/app/views/account/platform/access_tokens/_index.html.erb +91 -0
- data/app/views/account/platform/access_tokens/_menu_item.html.erb +10 -0
- data/app/views/account/platform/access_tokens/edit.html.erb +12 -0
- data/app/views/account/platform/access_tokens/index.html.erb +6 -0
- data/app/views/account/platform/access_tokens/new.html.erb +12 -0
- data/app/views/account/platform/access_tokens/show.html.erb +36 -0
- data/app/views/account/platform/applications/_application.json.jbuilder +0 -1
- data/app/views/account/platform/applications/_form.html.erb +0 -1
- data/app/views/account/platform/applications/_index.html.erb +1 -3
- data/app/views/account/platform/applications/show.html.erb +2 -3
- data/app/views/api/v1/platform/access_tokens/_access_token.json.jbuilder +10 -0
- data/app/views/api/v1/platform/access_tokens/index.json.jbuilder +5 -0
- data/app/views/api/v1/platform/access_tokens/show.json.jbuilder +1 -0
- data/config/locales/en/platform/access_tokens.en.yml +109 -0
- data/config/locales/en/platform/applications.en.yml +5 -14
- data/config/routes.rb +19 -1
- data/lib/bullet_train/api/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f74e01f8b6f3b2eafac8bd31e934ffd26ca0a286c5d38081884089f034f5515e
|
4
|
+
data.tar.gz: 32fe4b66a1d33d9b1754a9978c9b800c18389fda615f681c38a9fb254aa4255c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5fe1616498933e0c55258cae6a4bd4f17c33bbf7ff5c15595a807fd103fcde3e648a600e7f71833874271dcae75b366d8cdc209b11d2a88003992f84373369
|
7
|
+
data.tar.gz: b5b543622985e9d25dcf91b05839a0af7dc7740751e0b2d4a1adbb16ec09babcd3482dddadee8d2fa9834cf69b31d749f929860954af4fac27433d67a9f0572d
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class Account::Platform::AccessTokensController < Account::ApplicationController
|
2
|
+
account_load_and_authorize_resource :access_token, through: :application, through_association: :access_tokens
|
3
|
+
|
4
|
+
# GET /account/platform/applications/:application_id/access_tokens
|
5
|
+
# GET /account/platform/applications/:application_id/access_tokens.json
|
6
|
+
def index
|
7
|
+
delegate_json_to_api do
|
8
|
+
redirect_to [:account, @application]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# GET /account/platform/access_tokens/:id
|
13
|
+
# GET /account/platform/access_tokens/:id.json
|
14
|
+
def show
|
15
|
+
delegate_json_to_api do
|
16
|
+
redirect_to [:account, @application]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# GET /account/platform/applications/:application_id/access_tokens/new
|
21
|
+
def new
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /account/platform/access_tokens/:id/edit
|
25
|
+
def edit
|
26
|
+
end
|
27
|
+
|
28
|
+
# POST /account/platform/applications/:application_id/access_tokens
|
29
|
+
# POST /account/platform/applications/:application_id/access_tokens.json
|
30
|
+
def create
|
31
|
+
@access_token.provisioned = true
|
32
|
+
|
33
|
+
respond_to do |format|
|
34
|
+
if @access_token.save
|
35
|
+
format.html { redirect_to [:account, @application, :access_tokens], notice: I18n.t("platform/access_tokens.notifications.created") }
|
36
|
+
format.json { render :show, status: :created, location: [:account, @access_token] }
|
37
|
+
else
|
38
|
+
format.html { render :new, status: :unprocessable_entity }
|
39
|
+
format.json { render json: @access_token.errors, status: :unprocessable_entity }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# PATCH/PUT /account/platform/access_tokens/:id
|
45
|
+
# PATCH/PUT /account/platform/access_tokens/:id.json
|
46
|
+
def update
|
47
|
+
respond_to do |format|
|
48
|
+
if @access_token.update(access_token_params)
|
49
|
+
format.html { redirect_to [:account, @access_token], notice: I18n.t("platform/access_tokens.notifications.updated") }
|
50
|
+
format.json { render :show, status: :ok, location: [:account, @access_token] }
|
51
|
+
else
|
52
|
+
format.html { render :edit, status: :unprocessable_entity }
|
53
|
+
format.json { render json: @access_token.errors, status: :unprocessable_entity }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# DELETE /account/platform/access_tokens/:id
|
59
|
+
# DELETE /account/platform/access_tokens/:id.json
|
60
|
+
def destroy
|
61
|
+
@access_token.destroy
|
62
|
+
respond_to do |format|
|
63
|
+
format.html { redirect_to [:account, @application, :access_tokens], notice: I18n.t("platform/access_tokens.notifications.destroyed") }
|
64
|
+
format.json { head :no_content }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
include strong_parameters_from_api
|
71
|
+
|
72
|
+
def process_params(strong_params)
|
73
|
+
assign_date_and_time(strong_params, :last_used_at)
|
74
|
+
# 🚅 super scaffolding will insert processing for new fields above this line.
|
75
|
+
end
|
76
|
+
end
|
@@ -26,7 +26,7 @@ class Account::Platform::ApplicationsController < Account::ApplicationController
|
|
26
26
|
def create
|
27
27
|
respond_to do |format|
|
28
28
|
if @application.save
|
29
|
-
format.html { redirect_to [:account, @
|
29
|
+
format.html { redirect_to [:account, @application], notice: I18n.t("platform/applications.notifications.created") }
|
30
30
|
format.json { render :show, status: :created, location: [:account, @application] }
|
31
31
|
else
|
32
32
|
format.html { render :new, status: :unprocessable_entity }
|
@@ -63,16 +63,13 @@ class Account::Platform::ApplicationsController < Account::ApplicationController
|
|
63
63
|
|
64
64
|
# Never trust parameters from the scary internet, only allow the white list through.
|
65
65
|
def application_params
|
66
|
-
|
66
|
+
params.require(:platform_application).permit(
|
67
67
|
:name,
|
68
|
-
:scopes,
|
69
68
|
:redirect_uri,
|
70
69
|
# 🚅 super scaffolding will insert new fields above this line.
|
71
70
|
# 🚅 super scaffolding will insert new arrays above this line.
|
72
71
|
)
|
73
72
|
|
74
73
|
# 🚅 super scaffolding will insert processing for new fields above this line.
|
75
|
-
|
76
|
-
strong_params
|
77
74
|
end
|
78
75
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class Api::V1::Platform::AccessTokensController < Api::V1::ApplicationController
|
2
|
+
account_load_and_authorize_resource :access_token, through: :application, through_association: :access_tokens
|
3
|
+
|
4
|
+
# GET /api/v1/platform/access_tokens/:id
|
5
|
+
def show
|
6
|
+
end
|
7
|
+
|
8
|
+
# POST /api/v1/platform/applications/:application_id/access_tokens
|
9
|
+
def create
|
10
|
+
@access_token.provisioned = true
|
11
|
+
|
12
|
+
if @access_token.save
|
13
|
+
render :show, status: :created, location: [:api, :v1, @access_token]
|
14
|
+
else
|
15
|
+
render json: @access_token.errors, status: :unprocessable_entity
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# PATCH/PUT /api/v1/platform/access_tokens/:id
|
20
|
+
def update
|
21
|
+
if @access_token.update(access_token_params)
|
22
|
+
render :show
|
23
|
+
else
|
24
|
+
render json: @access_token.errors, status: :unprocessable_entity
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# DELETE /api/v1/platform/access_tokens/:id
|
29
|
+
def destroy
|
30
|
+
@access_token.destroy
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
module StrongParameters
|
36
|
+
# Only allow a list of trusted parameters through.
|
37
|
+
def access_token_params
|
38
|
+
strong_params = params.require(:platform_access_token).permit(
|
39
|
+
*permitted_fields,
|
40
|
+
:description,
|
41
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
42
|
+
*permitted_arrays,
|
43
|
+
# 🚅 super scaffolding will insert new arrays above this line.
|
44
|
+
)
|
45
|
+
|
46
|
+
process_params(strong_params)
|
47
|
+
|
48
|
+
strong_params
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
include StrongParameters
|
53
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Platform::AccessToken < ApplicationRecord
|
2
|
+
self.table_name = "oauth_access_tokens"
|
3
|
+
|
4
|
+
include Doorkeeper::Orm::ActiveRecord::Mixins::AccessToken
|
5
|
+
# 🚅 add concerns above.
|
6
|
+
|
7
|
+
# 🚅 add concerns above.
|
8
|
+
|
9
|
+
# 🚅 add attribute accessors above.
|
10
|
+
|
11
|
+
# 🚅 add belongs_to associations above.
|
12
|
+
|
13
|
+
# 🚅 add has_many associations above.
|
14
|
+
|
15
|
+
has_one :team, through: :application
|
16
|
+
# 🚅 add has_one associations above.
|
17
|
+
|
18
|
+
# 🚅 add scopes above.
|
19
|
+
|
20
|
+
validates :token, presence: true
|
21
|
+
validates :description, presence: true, if: :provisioned?
|
22
|
+
# 🚅 add validations above.
|
23
|
+
|
24
|
+
# 🚅 add callbacks above.
|
25
|
+
|
26
|
+
# 🚅 add delegations above.
|
27
|
+
|
28
|
+
def label_string
|
29
|
+
description
|
30
|
+
end
|
31
|
+
# 🚅 add methods above.
|
32
|
+
end
|
@@ -20,6 +20,7 @@ class Platform::Application < ApplicationRecord
|
|
20
20
|
# 🚅 add validations above.
|
21
21
|
|
22
22
|
after_create :create_user_and_membership
|
23
|
+
after_create :create_access_token
|
23
24
|
after_update :update_user_and_membership
|
24
25
|
before_destroy :destroy_user
|
25
26
|
# 🚅 add callbacks above.
|
@@ -37,6 +38,10 @@ class Platform::Application < ApplicationRecord
|
|
37
38
|
membership.roles << Role.admin
|
38
39
|
end
|
39
40
|
|
41
|
+
def create_access_token
|
42
|
+
access_tokens.create(resource_owner_id: user.id, description: "Default Access Token", provisioned: true)
|
43
|
+
end
|
44
|
+
|
40
45
|
def update_user_and_membership
|
41
46
|
user.update(first_name: label_string)
|
42
47
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% access_token ||= @access_token %>
|
2
|
+
<% application ||= @application || access_token&.application %>
|
3
|
+
<%= render 'account/platform/applications/breadcrumbs', application: application %>
|
4
|
+
<%= render 'account/shared/breadcrumb', label: t('.label'), url: [:account, application, :access_tokens] %>
|
5
|
+
<% if access_token&.persisted? %>
|
6
|
+
<%= render 'account/shared/breadcrumb', label: access_token.label_string, url: [:account, access_token] %>
|
7
|
+
<% end %>
|
8
|
+
<%= render 'account/shared/breadcrumbs/actions', only_for: 'platform/access_tokens' %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%= form_with model: access_token, url: (access_token.persisted? ? [:account, access_token] : [:account, @application, :access_tokens]), local: true, class: 'form' do |form| %>
|
2
|
+
<%= render 'account/shared/forms/errors', form: form %>
|
3
|
+
|
4
|
+
<% with_field_settings form: form do %>
|
5
|
+
<%= render 'shared/fields/text_field', method: :description, options: {autofocus: true} %>
|
6
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<div class="buttons">
|
10
|
+
<%= form.submit (form.object.persisted? ? t('.buttons.update') : t('.buttons.create')), class: "button" %>
|
11
|
+
<% if form.object.persisted? %>
|
12
|
+
<%= link_to t('global.buttons.cancel'), [:account, access_token], class: "button-secondary" %>
|
13
|
+
<% else %>
|
14
|
+
<%= link_to t('global.buttons.cancel'), [:account, @application, :access_tokens], class: "button-secondary" %>
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<% end %>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<% application = @application || @application %>
|
2
|
+
<% context ||= application %>
|
3
|
+
<% collection ||= :access_tokens %>
|
4
|
+
<% hide_actions ||= false %>
|
5
|
+
<% hide_back ||= false %>
|
6
|
+
|
7
|
+
<% access_tokens = access_tokens.order(:id) unless has_order?(access_tokens) %>
|
8
|
+
<% pagy, access_tokens = pagy(access_tokens, page_param: :access_tokens_page) %>
|
9
|
+
|
10
|
+
<%= action_model_select_controller do %>
|
11
|
+
<%= updates_for context, collection do %>
|
12
|
+
<%= render 'account/shared/box', pagy: pagy do |p| %>
|
13
|
+
<% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
|
14
|
+
<% p.content_for :description do %>
|
15
|
+
<%= t(".contexts.#{context.class.name.underscore}.description") %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% p.content_for :table do %>
|
19
|
+
<% if access_tokens.any? %>
|
20
|
+
<table class="table">
|
21
|
+
<thead>
|
22
|
+
<tr>
|
23
|
+
<%= render "shared/tables/select_all" %>
|
24
|
+
<th><%= t('.fields.token.heading') %></th>
|
25
|
+
<th><%= t('.fields.description.heading') %></th>
|
26
|
+
<th><%= t('.fields.last_used_at.heading') %></th>
|
27
|
+
<%# 🚅 super scaffolding will insert new field headers above this line. %>
|
28
|
+
<th><%= t('.fields.created_at.heading') %></th>
|
29
|
+
<th class="text-right"></th>
|
30
|
+
</tr>
|
31
|
+
</thead>
|
32
|
+
<tbody>
|
33
|
+
<% access_tokens.each do |access_token| %>
|
34
|
+
<% with_attribute_settings object: access_token do %>
|
35
|
+
<tr data-id="<%= access_token.id %>">
|
36
|
+
<%= render "shared/tables/checkbox", object: access_token %>
|
37
|
+
<td><%= render 'shared/attributes/code', attribute: :token, secret: true %></td>
|
38
|
+
<td><%= render 'shared/attributes/text', attribute: :description %></td>
|
39
|
+
<td>
|
40
|
+
<% if access_token.last_used_at %>
|
41
|
+
<%= render 'shared/attributes/date_and_time', attribute: :last_used_at %>
|
42
|
+
<% else %>
|
43
|
+
<% # TODO Make it so we can just define a `default` key for `last_used_at` in the locale file and it will us that when present. %>
|
44
|
+
Never
|
45
|
+
<% end %>
|
46
|
+
</td>
|
47
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
48
|
+
<td><%= render 'shared/attributes/date_and_time', attribute: :created_at %></td>
|
49
|
+
<td class="buttons">
|
50
|
+
<% unless hide_actions %>
|
51
|
+
<% if can? :edit, access_token %>
|
52
|
+
<%= link_to t('.buttons.shorthand.edit'), [:edit, :account, access_token], class: 'button-secondary button-smaller' %>
|
53
|
+
<% end %>
|
54
|
+
<% if can? :destroy, access_token %>
|
55
|
+
<%= button_to t('.buttons.shorthand.destroy'), [:account, access_token], method: :delete, data: { confirm: t('.buttons.confirmations.destroy', model_locales(access_token)) }, class: 'button-secondary button-smaller' %>
|
56
|
+
<% end %>
|
57
|
+
<%# 🚅 super scaffolding will insert new action model buttons above this line. %>
|
58
|
+
<% end %>
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
<% end %>
|
62
|
+
<% end %>
|
63
|
+
</tbody>
|
64
|
+
</table>
|
65
|
+
<% end %>
|
66
|
+
<% end %>
|
67
|
+
|
68
|
+
<% p.content_for :actions do %>
|
69
|
+
<% unless hide_actions %>
|
70
|
+
<% if context == application %>
|
71
|
+
<% if can? :create, Platform::AccessToken.new(application: application, provisioned: true) %>
|
72
|
+
<%= link_to t('.buttons.new'), [:new, :account, application, :access_token], class: "#{first_button_primary(:access_token)} new" %>
|
73
|
+
<% end %>
|
74
|
+
<% end %>
|
75
|
+
|
76
|
+
<%# 🚅 super scaffolding will insert new targets one parent action model buttons above this line. %>
|
77
|
+
<%# 🚅 super scaffolding will insert new bulk action model buttons above this line. %>
|
78
|
+
<%= render "shared/bulk_action_select" %>
|
79
|
+
|
80
|
+
<% unless hide_back %>
|
81
|
+
<%= link_to t('global.buttons.back'), [:account, context], class: "#{first_button_primary(:access_token)} back" %>
|
82
|
+
<% end %>
|
83
|
+
<% end %>
|
84
|
+
<% end %>
|
85
|
+
|
86
|
+
<% p.content_for :raw_footer do %>
|
87
|
+
<%# 🚅 super scaffolding will insert new action model index views above this line. %>
|
88
|
+
<% end %>
|
89
|
+
<% end %>
|
90
|
+
<% end %>
|
91
|
+
<% end %>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<% if can? :read, Platform::AccessToken.new(team: current_team) %>
|
2
|
+
<%= render 'account/shared/menu/item', {
|
3
|
+
url: main_app.polymorphic_path([:account, current_team, :platform_access_tokens]),
|
4
|
+
label: t('platform/access_tokens.navigation.label'),
|
5
|
+
} do |p| %>
|
6
|
+
<% p.content_for :icon do %>
|
7
|
+
<i class="<%= t('platform/access_tokens.navigation.icon') %>"></i>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= render 'account/shared/box', divider: true do |p| %>
|
5
|
+
<% p.content_for :title, t('.header') %>
|
6
|
+
<% p.content_for :description, t('.description') %>
|
7
|
+
<% p.content_for :body do %>
|
8
|
+
<%= render 'form', access_token: @access_token %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= render 'account/shared/box', divider: true do |p| %>
|
5
|
+
<% p.content_for :title, t('.header') %>
|
6
|
+
<% p.content_for :description, t('.description') %>
|
7
|
+
<% p.content_for :body do %>
|
8
|
+
<%= render 'form', access_token: @access_token %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%= render 'account/shared/page' do |p| %>
|
2
|
+
<% p.content_for :title, t('.section') %>
|
3
|
+
<% p.content_for :body do %>
|
4
|
+
<%= updates_for @access_token do %>
|
5
|
+
<%= render 'account/shared/box', divider: true do |p| %>
|
6
|
+
<% p.content_for :title, t('.header') %>
|
7
|
+
<% p.content_for :description do %>
|
8
|
+
<%= t('.description') %>
|
9
|
+
<%= t('.manage_description') if can? :manage, @access_token %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<% p.content_for :body do %>
|
13
|
+
<% with_attribute_settings object: @access_token, strategy: :label do %>
|
14
|
+
<%= render 'shared/attributes/text', attribute: :token %>
|
15
|
+
<%= render 'shared/attributes/date_and_time', attribute: :last_used_at %>
|
16
|
+
<%= render 'shared/attributes/text', attribute: :description %>
|
17
|
+
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<% p.content_for :actions do %>
|
22
|
+
<%= link_to t('.buttons.edit'), [:edit, :account, @access_token], class: first_button_primary if can? :edit, @access_token %>
|
23
|
+
<%# 🚅 super scaffolding will insert new action model buttons above this line. %>
|
24
|
+
<%= button_to t('.buttons.destroy'), [:account, @access_token], method: :delete, class: first_button_primary, data: { confirm: t('.buttons.confirmations.destroy', model_locales(@access_token)) } if can? :destroy, @access_token %>
|
25
|
+
<%= link_to t('global.buttons.back'), [:account, @application, :access_tokens], class: first_button_primary %>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
<% p.content_for :raw_footer do %>
|
29
|
+
<%# 🚅 super scaffolding will insert new action model index views above this line. %>
|
30
|
+
<% end %>
|
31
|
+
<% end %>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<%# 🚅 super scaffolding will insert new children above this line. %>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
<% with_field_settings form: form do %>
|
5
5
|
<%= render 'shared/fields/text_field', method: :name, options: {autofocus: true} %>
|
6
|
-
<%= render 'shared/fields/text_field', method: :scopes %>
|
7
6
|
<%= render 'shared/fields/text_field', method: :redirect_uri %>
|
8
7
|
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
9
8
|
<% end %>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<%= render 'account/shared/box' do |p| %>
|
8
8
|
<% p.content_for :title, t(".contexts.#{context.class.name.underscore}.header") %>
|
9
9
|
<% p.content_for :description do %>
|
10
|
-
<%= t(".contexts.#{context.class.name.underscore}.description
|
10
|
+
<%= t(".contexts.#{context.class.name.underscore}.description") %>
|
11
11
|
<% end %>
|
12
12
|
|
13
13
|
<% p.content_for :table do %>
|
@@ -16,7 +16,6 @@
|
|
16
16
|
<thead>
|
17
17
|
<tr>
|
18
18
|
<th><%= t('.fields.name.heading') %></th>
|
19
|
-
<th><%= t('.fields.scopes.heading') %></th>
|
20
19
|
<%# 🚅 super scaffolding will insert new field headers above this line. %>
|
21
20
|
<th><%= t('.fields.created_at.heading') %></th>
|
22
21
|
<th class="text-right"></th>
|
@@ -27,7 +26,6 @@
|
|
27
26
|
<% with_attribute_settings object: application do %>
|
28
27
|
<tr data-id="<%= application.id %>">
|
29
28
|
<td><%= render 'shared/attributes/text', attribute: :name, url: [:account, application] %></td>
|
30
|
-
<td><%= render 'shared/attributes/text', attribute: :scopes %></td>
|
31
29
|
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
32
30
|
<td><%= display_date_and_time(application.created_at) %></td>
|
33
31
|
<td class="buttons">
|
@@ -5,15 +5,13 @@
|
|
5
5
|
<% p.content_for :title, t('.header') %>
|
6
6
|
<% p.content_for :description do %>
|
7
7
|
<%= t('.description') %>
|
8
|
-
<%= t('.manage_description') if can? :manage, @application %>
|
9
8
|
<% end %>
|
10
9
|
|
11
10
|
<% p.content_for :body do %>
|
12
11
|
<% with_attribute_settings object: @application, strategy: :label do %>
|
13
12
|
<%= render 'shared/attributes/text', attribute: :name %>
|
14
13
|
<%= render 'shared/attributes/code', attribute: :uid %>
|
15
|
-
<%= render 'shared/attributes/code', attribute: :secret %>
|
16
|
-
<%= render 'shared/attributes/text', attribute: :scopes %>
|
14
|
+
<%= render 'shared/attributes/code', attribute: :secret, secret: true %>
|
17
15
|
<%= render 'shared/attributes/text', attribute: :redirect_uri %>
|
18
16
|
<%# 🚅 super scaffolding will insert new fields above this line. %>
|
19
17
|
<% end %>
|
@@ -26,6 +24,7 @@
|
|
26
24
|
<% end %>
|
27
25
|
<% end %>
|
28
26
|
|
27
|
+
<%= render 'account/platform/access_tokens/index', access_tokens: @application.access_tokens.accessible_by(current_ability), hide_back: true %>
|
29
28
|
<%# 🚅 super scaffolding will insert new children above this line. %>
|
30
29
|
<% end %>
|
31
30
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! "api/v1/platform/access_tokens/access_token", access_token: @access_token
|
@@ -0,0 +1,109 @@
|
|
1
|
+
en:
|
2
|
+
platform/access_tokens: &access_tokens
|
3
|
+
label: &label API Access Tokens
|
4
|
+
breadcrumbs:
|
5
|
+
label: *label
|
6
|
+
navigation:
|
7
|
+
label: *label
|
8
|
+
icon: fal fa-puzzle-piece
|
9
|
+
buttons: &buttons
|
10
|
+
new: Provision New Access Token
|
11
|
+
create: Create Access Token
|
12
|
+
edit: Edit Access Token
|
13
|
+
update: Update Access Token
|
14
|
+
destroy: Remove Access Token
|
15
|
+
shorthand:
|
16
|
+
edit: Edit
|
17
|
+
destroy: Delete
|
18
|
+
confirmations:
|
19
|
+
# TODO customize for your use-case.
|
20
|
+
destroy: Are you sure you want to remove %{access_token_name}? This will break any active integrations using this token and can't be undone.
|
21
|
+
fields: &fields
|
22
|
+
id:
|
23
|
+
heading: Access Token ID
|
24
|
+
application_id:
|
25
|
+
heading: Application ID
|
26
|
+
token:
|
27
|
+
_: &token Token
|
28
|
+
label: *token
|
29
|
+
heading: *token
|
30
|
+
expires_in:
|
31
|
+
_: &expires_in Expires In
|
32
|
+
label: *expires_in
|
33
|
+
heading: *expires_in
|
34
|
+
scopes:
|
35
|
+
_: &scopes Scopes
|
36
|
+
label: *scopes
|
37
|
+
heading: *scopes
|
38
|
+
last_used_at:
|
39
|
+
_: &last_used_at Last Used At
|
40
|
+
label: *last_used_at
|
41
|
+
heading: *last_used_at
|
42
|
+
description:
|
43
|
+
_: &description Description
|
44
|
+
label: *description
|
45
|
+
heading: *description
|
46
|
+
# 🚅 super scaffolding will insert new fields above this line.
|
47
|
+
created_at:
|
48
|
+
_: &created_at Created
|
49
|
+
label: *created_at
|
50
|
+
heading: *created_at
|
51
|
+
updated_at:
|
52
|
+
_: &updated_at Updated
|
53
|
+
label: *updated_at
|
54
|
+
heading: *updated_at
|
55
|
+
api:
|
56
|
+
collection_actions: "Collection Actions for Access Tokens"
|
57
|
+
index: "List Access Tokens"
|
58
|
+
create: "Add a New Access Token"
|
59
|
+
member_actions: "Actions for an Individual Access Token"
|
60
|
+
show: "Retrieve a Access Token"
|
61
|
+
update: "Update a Access Token"
|
62
|
+
destroy: "Delete a Access Token"
|
63
|
+
fields: *fields
|
64
|
+
index:
|
65
|
+
section: "%{applications_possessive} API Access Tokens"
|
66
|
+
contexts:
|
67
|
+
platform/application:
|
68
|
+
header: API Access Tokens
|
69
|
+
description: You can use Access Tokens to allow %{application_name} to make requests to the API.
|
70
|
+
fields: *fields
|
71
|
+
buttons: *buttons
|
72
|
+
show:
|
73
|
+
section: "%{access_token_name}"
|
74
|
+
header: Access Token Details
|
75
|
+
description: Below are the details we have for %{access_token_name}.
|
76
|
+
manage_description: You'll also find options for updating these details or removing %{access_token_name} from %{application_name} entirely.
|
77
|
+
fields: *fields
|
78
|
+
buttons: *buttons
|
79
|
+
form: &form
|
80
|
+
buttons: *buttons
|
81
|
+
fields: *fields
|
82
|
+
new:
|
83
|
+
section: "New Access Token for %{application_name}"
|
84
|
+
header: New Access Token Details
|
85
|
+
description: Please provide the details of the new Access Token you'd like to add to %{application_name}.
|
86
|
+
form: *form
|
87
|
+
edit:
|
88
|
+
section: "%{access_token_name}"
|
89
|
+
header: Edit Access Token Details
|
90
|
+
description: You can update the settings for %{access_token_name} below.
|
91
|
+
form: *form
|
92
|
+
notifications:
|
93
|
+
created: Access Token was successfully created.
|
94
|
+
updated: Access Token was successfully updated.
|
95
|
+
destroyed: Access Token was successfully destroyed.
|
96
|
+
account:
|
97
|
+
platform:
|
98
|
+
access_tokens: *access_tokens
|
99
|
+
activerecord:
|
100
|
+
attributes:
|
101
|
+
platform/access_token:
|
102
|
+
token: *token
|
103
|
+
expires_in: *expires_in
|
104
|
+
scopes: *scopes
|
105
|
+
last_used_at: *last_used_at
|
106
|
+
description: *description
|
107
|
+
# 🚅 super scaffolding will insert new activerecord attributes above this line.
|
108
|
+
created_at: *created_at
|
109
|
+
updated_at: *updated_at
|
@@ -7,7 +7,7 @@ en:
|
|
7
7
|
label: Your Applications
|
8
8
|
icon: fal fa-browser ti ti-plug
|
9
9
|
buttons: &buttons
|
10
|
-
new:
|
10
|
+
new: Provision New Platform Application
|
11
11
|
create: Provision Platform Application
|
12
12
|
edit: Edit Platform Application
|
13
13
|
update: Update Platform Application
|
@@ -18,7 +18,7 @@ en:
|
|
18
18
|
disconnect: Disconnect
|
19
19
|
confirmations:
|
20
20
|
# TODO customize for your use-case.
|
21
|
-
destroy: Are you sure you want to remove %{application_name}? This will
|
21
|
+
destroy: Are you sure you want to remove %{application_name}? This will break any integrations using this client UID and secret and any associated API access tokens. This can't be undone.
|
22
22
|
disconnect: Are you sure you want to disconnect %{application_name}? This might affect an ongoing service provided by %{application_name} and can not be undone.
|
23
23
|
fields: &fields
|
24
24
|
name:
|
@@ -26,17 +26,11 @@ en:
|
|
26
26
|
label: *name
|
27
27
|
heading: Application Name
|
28
28
|
|
29
|
-
scopes:
|
30
|
-
_: &scopes Scopes
|
31
|
-
label: *scopes
|
32
|
-
heading: *scopes
|
33
|
-
help: Scopes are like permissions. An OAuth application can have read, write, and/or delete access. Separate scopes with spaces. Leave this field blank to use the default scope, e.g. "read". Optional scopes are "write" and "delete".
|
34
|
-
|
35
29
|
redirect_uri:
|
36
30
|
_: &redirect_uri Redirect URI
|
37
31
|
label: *redirect_uri
|
38
32
|
heading: *redirect_uri
|
39
|
-
help:
|
33
|
+
help: This is only required if you're building an OAuth2-powered integration for other users.
|
40
34
|
|
41
35
|
uid:
|
42
36
|
heading: Client UID
|
@@ -61,15 +55,13 @@ en:
|
|
61
55
|
contexts:
|
62
56
|
team:
|
63
57
|
header: Platform Applications
|
64
|
-
description:
|
65
|
-
description_empty: No Platform Applications have been provisioned for %{team_name}.
|
58
|
+
description: Platform Applications allow you to build API integrations for %{team_name} or build OAuth2-powered integrations that %{team_name} can share with others.
|
66
59
|
fields: *fields
|
67
60
|
buttons: *buttons
|
68
61
|
show:
|
69
62
|
section: "%{application_name}"
|
70
63
|
header: Platform Application Details
|
71
|
-
description: Below
|
72
|
-
manage_description: You'll also find options for updating these details or removing %{application_name} from %{team_name} entirely.
|
64
|
+
description: Below is the configuration and OAuth2 credentials for %{application_name}.
|
73
65
|
fields: *fields
|
74
66
|
buttons: *buttons
|
75
67
|
form: &form
|
@@ -96,7 +88,6 @@ en:
|
|
96
88
|
attributes:
|
97
89
|
platform/application:
|
98
90
|
name: *name
|
99
|
-
scopes: *scopes
|
100
91
|
redirect_uri: *redirect_uri
|
101
92
|
# 🚅 super scaffolding will insert new activerecord attributes above this line.
|
102
93
|
created_at: *created_at
|
data/config/routes.rb
CHANGED
@@ -1,6 +1,22 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
use_doorkeeper
|
3
3
|
|
4
|
+
# See `config/routes.rb` in the starter repository for details.
|
5
|
+
collection_actions = [:index, :new, :create] # standard:disable Lint/UselessAssignment
|
6
|
+
extending = {only: []}
|
7
|
+
|
8
|
+
namespace :account do
|
9
|
+
shallow do
|
10
|
+
resources :teams, extending do
|
11
|
+
namespace :platform do
|
12
|
+
resources :applications do
|
13
|
+
resources :access_tokens
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
4
20
|
namespace :api do
|
5
21
|
namespace :v1 do
|
6
22
|
shallow do
|
@@ -9,7 +25,9 @@ Rails.application.routes.draw do
|
|
9
25
|
resources :invitations
|
10
26
|
resources :memberships
|
11
27
|
namespace :platform do
|
12
|
-
resources :applications
|
28
|
+
resources :applications do
|
29
|
+
resources :access_tokens
|
30
|
+
end
|
13
31
|
end
|
14
32
|
end
|
15
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bullet_train-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Culver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: standard
|
@@ -120,11 +120,22 @@ files:
|
|
120
120
|
- README.md
|
121
121
|
- Rakefile
|
122
122
|
- app/assets/config/bullet_train_api_manifest.js
|
123
|
+
- app/controllers/account/platform/access_tokens_controller.rb
|
123
124
|
- app/controllers/account/platform/applications_controller.rb
|
125
|
+
- app/controllers/api/v1/platform/access_tokens_controller.rb
|
124
126
|
- app/controllers/concerns/api/controllers/base.rb
|
125
127
|
- app/controllers/concerns/api/v1/teams/controller_base.rb
|
126
128
|
- app/controllers/concerns/api/v1/users/controller_base.rb
|
129
|
+
- app/models/platform/access_token.rb
|
127
130
|
- app/models/platform/application.rb
|
131
|
+
- app/views/account/platform/access_tokens/_breadcrumbs.html.erb
|
132
|
+
- app/views/account/platform/access_tokens/_form.html.erb
|
133
|
+
- app/views/account/platform/access_tokens/_index.html.erb
|
134
|
+
- app/views/account/platform/access_tokens/_menu_item.html.erb
|
135
|
+
- app/views/account/platform/access_tokens/edit.html.erb
|
136
|
+
- app/views/account/platform/access_tokens/index.html.erb
|
137
|
+
- app/views/account/platform/access_tokens/new.html.erb
|
138
|
+
- app/views/account/platform/access_tokens/show.html.erb
|
128
139
|
- app/views/account/platform/applications/_application.json.jbuilder
|
129
140
|
- app/views/account/platform/applications/_breadcrumbs.html.erb
|
130
141
|
- app/views/account/platform/applications/_form.html.erb
|
@@ -136,12 +147,16 @@ files:
|
|
136
147
|
- app/views/account/platform/applications/new.html.erb
|
137
148
|
- app/views/account/platform/applications/show.html.erb
|
138
149
|
- app/views/account/platform/applications/show.json.jbuilder
|
150
|
+
- app/views/api/v1/platform/access_tokens/_access_token.json.jbuilder
|
151
|
+
- app/views/api/v1/platform/access_tokens/index.json.jbuilder
|
152
|
+
- app/views/api/v1/platform/access_tokens/show.json.jbuilder
|
139
153
|
- app/views/api/v1/teams/index.json.jbuilder
|
140
154
|
- app/views/api/v1/teams/show.json.jbuilder
|
141
155
|
- app/views/api/v1/users/index.json.jbuilder
|
142
156
|
- app/views/api/v1/users/show.json.jbuilder
|
143
157
|
- config/locales/en/api.en.yml
|
144
158
|
- config/locales/en/me.en.yml
|
159
|
+
- config/locales/en/platform/access_tokens.en.yml
|
145
160
|
- config/locales/en/platform/applications.en.yml
|
146
161
|
- config/routes.rb
|
147
162
|
- lib/bullet_train/api.rb
|