Adds the ability for users to delete their own account (#10664). Can be disabled in application settings.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9417 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user