diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 6c57367..19f81e7 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -42,17 +42,19 @@ class UsersController < AdminController
def deactivate
person = environment.people.find(params[:id])
person.user.deactivate
- puts "++"*80, person
- puts "++"*80, person.user
- puts "++"*80, person.user.activated?
redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
end
-
+
def destroy_user
- person = environment.people.find(params[:id])
- person.destroy
- session[:notice] = _('The profile was deleted.')
+ if request.post?
+ person = environment.people.find(params[:id])
+ if person.destroy
+ session[:notice] = _('The profile was deleted.')
+ else
+ session[:notice] = _('Could not delete profile')
+ end
+ end
redirect_to :action => :index, :q => params[:q], :filter => params[:filter]
end
@@ -98,7 +100,7 @@ class UsersController < AdminController
end
end
- private
+ private
def per_page
10
diff --git a/app/views/users/_users_list.rhtml b/app/views/users/_users_list.rhtml
index 2edd70d..2cfa1e7 100644
--- a/app/views/users/_users_list.rhtml
+++ b/app/views/users/_users_list.rhtml
@@ -19,18 +19,16 @@
<% if p.is_admin? %>
- <%= button_without_text :'reset-admin-role', _('Reset admin role'), {:action => 'reset_admin_role', :id => p, :q => @q}, :filter => @filter, :confirm => "delete_article_message(@article)" %>
+ <%= button_without_text :'reset-admin-role', _('Reset admin role'), {:action => 'reset_admin_role', :id => p, :q => @q}, :filter => @filter, :confirm => _("Do you want to reset this user as administrator?") %>
<% else %>
- <%= button_without_text :'set-admin-role', _('Set admin role'), {:action => 'set_admin_role', :id => p, :q => @q}, :filter => @filter, :confirm => "delete_article_message(@article)" %>
+ <%= button_without_text :'set-admin-role', _('Set admin role'), {:action => 'set_admin_role', :id => p, :q => @q}, :filter => @filter, :confirm => _("Do you want to set this user as administrator?") %>
<% end %>
<% if !p.user.activated? %>
- <%= button_without_text :'activate-user', _('Activate user'), {:action => 'activate', :id => p, :q => @q}, :filter => @filter, :confirm => "delete_article_message(@article)" %>
+ <%= button_without_text :'activate-user', _('Activate user'), {:action => 'activate', :id => p, :q => @q}, :filter => @filter, :confirm => _("Do you want to activate this user?") %>
<% else %>
- <%= button_without_text :'deactivate-user', _('Deactivate user'), {:action => 'deactivate', :id => p, :q => @q}, :filter => @filter, :confirm => "delete_article_message(@article)" %>
+ <%= button_without_text :'deactivate-user', _('Deactivate user'), {:action => 'deactivate', :id => p, :q => @q}, :filter => @filter, :confirm => _("Do you want to deactivate this user?") %>
<% end %>
-
- <%= button_without_text :'delete', _('Ban'), {:action => :destroy_user, :id => p, :q => @q}, :filter => @filter, :confirm => "delete_article_message(@article)" %>
-
+ <%= button_without_text :'delete', _('Remove'), {:action => :destroy_user, :id => p, :q => @q}, :method => :post, :filter => @filter, :confirm => _("Do you want to remove this user?") %>
|
diff --git a/features/manage_users.feature b/features/manage_users.feature
new file mode 100644
index 0000000..1a97011
--- /dev/null
+++ b/features/manage_users.feature
@@ -0,0 +1,47 @@
+Feature: manage users
+ As an environment administrator
+ I want to manage users
+ In order to remove, activate, deactivate users, and set admin roles.
+
+Background:
+ Given the following users
+ | login | name |
+ | joaosilva | Joao Silva |
+ | paulosantos | Paulo Santos |
+ Given I am logged in as admin
+ Given I go to /admin/users
+
+ @selenium
+ Scenario: deactive user
+ When I follow "Deactivate user" within "tr[title='Joao Silva']"
+ And I confirm the "Do you want to deactivate this user?" dialog
+ Then I should see "Activate user" within "tr[title='Joao Silva']"
+
+ @selenium
+ Scenario: activate user
+ Given I follow "Deactivate user" within "tr[title='Paulo Santos']"
+ Given I confirm the "Do you want to deactivate this user?" dialog
+ When I follow "Activate user" within "tr[title='Paulo Santos']"
+ And I confirm the "Do you want to activate this user?" dialog
+ Then I should see "Deactivate user" within "tr[title='Paulo Santos']"
+
+ @selenium
+ Scenario: ban user
+ When I follow "Remove" within "tr[title='Joao Silva']"
+ And I confirm the "Do you want to remove this user?" dialog
+ And I go to /admin/users
+ Then I should not see "Joao Silva"
+
+ @selenium
+ Scenario: admin user
+ When I follow "Set admin role" within "tr[title='Joao Silva']"
+ And I confirm the "Do you want to set this user as administrator?" dialog
+ Then I should see "Reset admin role" within "tr[title='Joao Silva']"
+
+ @selenium
+ Scenario: unadmin user
+ Given I follow "Set admin role" within "tr[title='Paulo Santos']"
+ And I confirm the "Do you want to set this user as administrator?" dialog
+ When I follow "Reset admin role" within "tr[title='Paulo Santos']"
+ And I confirm the "Do you want to reset this user as administrator?" dialog
+ Then I should see "Set admin role" within "tr[title='Paulo Santos']"
\ No newline at end of file
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index cda9d51..c41ca88 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -4198,7 +4198,7 @@ h1#agenda-title {
}
.actions .members-buttons-cell {
-width : 100px
+ width : 100px
}
.controller-profile_members .msie6 .button-bar a {
--
libgit2 0.21.2