+ if self.is_admin_changed?
+ if self.is_admin != self.is_admin_was
+ logger.warn "User #{current_user.uuid} tried to change is_admin from #{self.is_admin_was} to #{self.is_admin} for #{self.uuid}"
+ self.is_admin = self.is_admin_was
+ end
+ end
+ true
+ end
+
+ def prevent_inactive_admin
+ if self.is_admin and not self.is_active
+ # There is no known use case for the strange set of permissions
+ # that would result from this change. It's safest to assume it's
+ # a mistake and disallow it outright.
+ raise "Admin users cannot be inactive"
+ end