Class: ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ApplicationController
- Includes:
- Mumuki::Laboratory::Controllers::Authorization, Mumuki::Laboratory::Controllers::CurrentOrganization, Mumuki::Laboratory::Controllers::DynamicErrors, Mumuki::Laboratory::Controllers::Notifications, Mumukit::Login::AuthenticationHelpers
- Defined in:
- app/controllers/application_controller.rb
Direct Known Subclasses
AjaxController, AppendixesController, AssetsController, BookController, ChaptersController, ExercisesController, GuideContainerController, GuideProgressController, GuidesController, InvitationsController, LoginController, UsersController
Instance Method Summary collapse
-
#login_button(options = {}) ⇒ Object
required by Mumukit::Login.
- #redirect_to_main_organization! ⇒ Object
- #should_choose_organization? ⇒ Boolean
- #should_redirect_to_main_organization? ⇒ Boolean
-
#validate_accessible! ⇒ Object
ensures contents are accessible to current user.
Methods included from Mumuki::Laboratory::Controllers::DynamicErrors
#forbidden, #gone, #internal_server_error, #not_found, #unauthorized
Methods included from Mumuki::Laboratory::Controllers::Notifications
#has_notifications?, #notifications_count, #user_notifications_path
Methods included from Mumuki::Laboratory::Controllers::Authorization
#authorization_slug, #authorize_if_private!, #from_sessions?
Methods included from Mumuki::Laboratory::Controllers::CurrentOrganization
#organization_name, #set_current_organization!, #visit_organization!
Instance Method Details
#login_button(options = {}) ⇒ Object
required by Mumukit::Login
47 48 49 |
# File 'app/controllers/application_controller.rb', line 47 def (={}) login_form. I18n.t(:sign_in), [:class] end |
#redirect_to_main_organization! ⇒ Object
31 32 33 |
# File 'app/controllers/application_controller.rb', line 31 def redirect_to_main_organization! redirect_to current_user.main_organization.url_for(request.path) end |
#should_choose_organization? ⇒ Boolean
35 36 37 38 39 |
# File 'app/controllers/application_controller.rb', line 35 def should_choose_organization? current_user? && current_user.has_accessible_organizations? && Mumukit::Platform.implicit_organization?(request) end |
#should_redirect_to_main_organization? ⇒ Boolean
27 28 29 |
# File 'app/controllers/application_controller.rb', line 27 def should_redirect_to_main_organization? should_choose_organization? && current_user.has_immersive_main_organization? end |
#validate_accessible! ⇒ Object
ensures contents are accessible to current user
42 43 44 |
# File 'app/controllers/application_controller.rb', line 42 def validate_accessible! accessible_subject.validate_accessible_for!(current_user) unless (current_user? && current_user.teacher_here?) end |