make user an admin only if user is the first one after the deleted user.

This commit is contained in:
Stella Rouzi 2014-09-12 08:47:50 +03:00 committed by Stella
parent 0d51220a8c
commit 57c73f9eae

View file

@ -114,7 +114,9 @@ class User < ActiveRecord::Base
end
def setup_role
self.is_admin = true if User.count == 1
if User.count == 1 && User.first.email == 'deleted@localhost.osem'
self.is_admin = true
end
end
# Gets the roles of the user, groups them by role.name and returns the resource(s) of each role