diff options
Diffstat (limited to 'app/models/user.rb')
-rw-r--r-- | app/models/user.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index d1fa2822a..b377dda67 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -482,6 +482,12 @@ class User < Principal allowed_to?(action, nil, options.reverse_merge(:global => true), &block) end + # Returns true if the user is allowed to delete his own account + def own_account_deletable? + Setting.unsubscribe? && + (!admin? || User.active.first(:conditions => ["admin = ? AND id <> ?", true, id]).present?) + end + safe_attributes 'login', 'firstname', 'lastname', |