Add button to revoke own role
This commit is contained in:
parent
ec32b8cf54
commit
b37b1bc92d
6 changed files with 46 additions and 2 deletions
|
@ -16,7 +16,8 @@
|
|||
<td>
|
||||
<% if policy(country_state).show? %>
|
||||
<%= link_to country_state,
|
||||
role: :button, class: 'btn btn-light btn-sm' do %>
|
||||
role: :button,
|
||||
class: 'btn btn-light btn-sm' do %>
|
||||
<i class="far fa-eye"></i>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -27,7 +27,17 @@
|
|||
<td scope="row"><%= role.id %></td>
|
||||
<td><%= role.human_name %></td>
|
||||
<td><%= role.human_resource %></td>
|
||||
<td></td>
|
||||
<td>
|
||||
<% if policy([:settings, role]).destroy? %>
|
||||
<%= link_to [:settings, role],
|
||||
method: :delete,
|
||||
role: :button,
|
||||
class: 'btn btn-danger btn-sm' do %>
|
||||
<i class="fas fa-trash"></i>
|
||||
<%= translate '.revoke' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
|
|
@ -45,3 +45,7 @@ en:
|
|||
index:
|
||||
new_confirmation: New confirmation
|
||||
already_confirmed: You have already confirmed the passport.
|
||||
settings:
|
||||
roles:
|
||||
index:
|
||||
revoke: Revoke
|
||||
|
|
|
@ -46,3 +46,7 @@ ru:
|
|||
index:
|
||||
new_confirmation: Новое подтверждение
|
||||
already_confirmed: Вы уже подтвердили этот паспорт.
|
||||
settings:
|
||||
roles:
|
||||
index:
|
||||
revoke: Отозвать
|
||||
|
|
10
features/desktop/settings/roles.feature
Normal file
10
features/desktop/settings/roles.feature
Normal file
|
@ -0,0 +1,10 @@
|
|||
Feature: Roles
|
||||
Background:
|
||||
Given I am signed in as superuser
|
||||
|
||||
Scenario:
|
||||
When I visit "/settings/roles"
|
||||
Then I see text "Суперпользователь"
|
||||
|
||||
When I click the button "Отозвать"
|
||||
Then I do not see text "Суперпользователь"
|
|
@ -9,6 +9,21 @@ Given 'I am signed in as guest' do
|
|||
visit root_path guest_token: account.guest_token
|
||||
end
|
||||
|
||||
Given 'I am signed in as superuser' do
|
||||
account = create :superuser_account
|
||||
|
||||
visit '/users/sign_in'
|
||||
|
||||
within 'form' do
|
||||
fill_in 'Email', with: account.user.email
|
||||
fill_in 'Пароль', with: account.user.password
|
||||
|
||||
click_on 'Войти'
|
||||
end
|
||||
|
||||
expect(page).to have_css 'ul > li > a', text: account.user.account.username
|
||||
end
|
||||
|
||||
Given 'I am signed in with email {string}' do |email|
|
||||
@user = create :user, email: email
|
||||
|
||||
|
|
Reference in a new issue