alias_attribute :created_at, :creation_time
+ after_initialize :encrypt_password
before_save :encrypt_password
before_save :update_tile
after_save :spam_check
role? "administrator"
end
+ ##
+ # returns true if the user has the importer role, false otherwise
+ def importer?
+ role? "importer"
+ end
+
##
# returns true if the user has the requested role
def role?(role)
end
end
+ def deletion_allowed_at
+ unless Settings.user_account_deletion_delay.nil?
+ last_changeset = changesets.reorder(:closed_at => :desc).first
+ return last_changeset.closed_at.utc + Settings.user_account_deletion_delay.hours if last_changeset
+ end
+ creation_time.utc
+ end
+
+ def deletion_allowed?
+ deletion_allowed_at <= Time.now.utc
+ end
+
private
def encrypt_password