application_controller.rb 669 B

12345678910111213141516171819202122232425262728293031
  1. class Admin::ApplicationController < ApplicationController
  2. layout "admin"
  3. before_filter :must_be_admin
  4. def manifest
  5. self.class.manifest || "admin"
  6. end
  7. protected
  8. def self.allow_collaborators_to(*actions)
  9. skip_before_filter :must_be_admin, only: actions
  10. before_filter :must_be_admin_or_collaborator, only: actions
  11. end
  12. def must_be_admin
  13. unless user_signed_in? && current_user.admin?
  14. raise ActiveRecord::RecordNotFound
  15. end
  16. end
  17. def must_be_admin_or_collaborator
  18. unless user_signed_in? && (current_user.admin? || current_user.collaborator?)
  19. raise ActiveRecord::RecordNotFound
  20. end
  21. end
  22. def images
  23. end
  24. end