My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 53 attachment: dont_be_able_to_delete_yourself.patch (1.1 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Index: /home/edmundo/workspace_aptana/substruct_trunk/vendor/plugins/substruct/app/controllers/admin/users_controller.rb
===================================================================
--- /home/edmundo/workspace_aptana/substruct_trunk/vendor/plugins/substruct/app/controllers/admin/users_controller.rb (revision 43)
+++ /home/edmundo/workspace_aptana/substruct_trunk/vendor/plugins/substruct/app/controllers/admin/users_controller.rb (working copy)
@@ -48,12 +48,15 @@
end

def destroy
- if (User.count == 1) then
- flash[:notice] = "You have to have at least one user in the system. Try creating another one if you'd like to delete this one."
- redirect_to :back
- return
- end
- User.find(params[:id]).destroy
+ an_user = User.find(params[:id])
+ if an_user then
+ if (an_user.id == session[:user]) then
+ flash[:notice] = "You cannot delete yourself while loged on. Try using another administrator account to delete this one."
+ redirect_to :back
+ return
+ end
+ an_user.destroy
+ end
redirect_to :action => 'list'
end


Powered by Google Project Hosting