Skip to content

Commit

Permalink
Drop Webui::Users::TokenTriggersController
Browse files Browse the repository at this point in the history
It not used.
  • Loading branch information
hennevogel committed Nov 24, 2023
1 parent 1acc22d commit 5f01c6d
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 289 deletions.
4 changes: 0 additions & 4 deletions src/api/app/components/token_card_component.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@
- component.with_action do
= link_to(edit_token_path(@token), title: 'Edit Token', class: 'nav-link p-1') do
%i.fas.fa-edit
- if policy(@token).webui_trigger?
- component.with_action do
= link_to(token_trigger_path(@token), title: 'Trigger Token', class: 'nav-link p-1') do
%i.fas.fa-project-diagram
- if @token.type == 'Token::Workflow'
- component.with_action do
= link_to(token_users_path(@token.id), title: 'Share Token', class: 'nav-link p-1') do
Expand Down
62 changes: 0 additions & 62 deletions src/api/app/controllers/webui/users/token_triggers_controller.rb

This file was deleted.

6 changes: 0 additions & 6 deletions src/api/app/policies/token_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ def destroy?
create?
end

def webui_trigger?
return false unless user.is_active?

record.executor == user && !record.type.in?(['Token::Workflow', 'Token::Rss'])
end

def show?
record.executor == user && !record.type.in?(['Token::Rss'])
end
Expand Down

This file was deleted.

34 changes: 0 additions & 34 deletions src/api/app/views/webui/users/token_triggers/show.html.haml

This file was deleted.

4 changes: 0 additions & 4 deletions src/api/app/views/webui/users/tokens/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@
= link_to(edit_token_path(@token), class: 'ps-2', title: 'Edit') do
%i.fas.fa-edit
%span.nav-item-name Edit
- if policy(@token).webui_trigger?
= link_to(token_trigger_path(@token), class: 'ps-2', title: 'Trigger Token') do
%i.fas.fa-project-diagram
%span.nav-item-name Trigger Token
- if @token.type == 'Token::Workflow'
= link_to(token_users_path(@token.id), class: 'ps-2', title: 'Share') do
%i.fas.fa-users
Expand Down
1 change: 0 additions & 1 deletion src/api/config/routes/webui_routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@
resources :users, only: [:index, :create, :destroy], controller: 'webui/users/tokens/users', constraints: cons
resources :groups, only: [:create, :destroy], controller: 'webui/users/tokens/groups', constraints: cons
end
resources :token_triggers, only: [:show, :update], controller: 'webui/users/token_triggers'
end

get 'home', to: 'webui/webui#home', as: :home
Expand Down
1 change: 0 additions & 1 deletion src/api/spec/components/token_card_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
it { expect(rendered_content).to have_text("Id: #{token.id}") }
it { expect(rendered_content).to have_text("Operation: #{token.class.token_name.capitalize}") }
it { expect(rendered_content).to have_link(href: "/my/tokens/#{token.id}/edit") }
it { expect(rendered_content).to have_link(href: "/my/token_triggers/#{token.id}") }
end

context 'token with a package assigned' do
Expand Down
163 changes: 0 additions & 163 deletions src/api/spec/controllers/webui/users/token_triggers_controller_spec.rb

This file was deleted.

7 changes: 1 addition & 6 deletions src/api/spec/policies/token_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

subject { described_class }

permissions :webui_trigger?, :show? do
permissions :show? do
it { is_expected.not_to permit(other_user, user_token) }
it { is_expected.not_to permit(token_user, rss_token) }

Expand All @@ -24,11 +24,6 @@
it { is_expected.to permit(token_user, workflow_token) }
end

permissions :webui_trigger? do
it { is_expected.not_to permit(token_user, workflow_token) }
it { is_expected.not_to permit(unconfirmed_user, token_of_unconfirmed_user) }
end

# New action is permitted on any kind of token and user
permissions :new? do
it { is_expected.to permit(token_user, Token.new) }
Expand Down

0 comments on commit 5f01c6d

Please sign in to comment.