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::EmbeddedMode, 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::EmbeddedMode
#embedded_mode?, #enable_embedded_rendering, #standalone_mode?
Methods included from Mumuki::Laboratory::Controllers::DynamicErrors
#blocked_forum, #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
51 52 53 |
# File 'app/controllers/application_controller.rb', line 51 def (={}) login_form. I18n.t(:sign_in), [:class] end |
#redirect_to_main_organization! ⇒ Object
34 35 36 |
# File 'app/controllers/application_controller.rb', line 34 def redirect_to_main_organization! redirect_to current_user.main_organization.url_for(request.path) end |
#should_choose_organization? ⇒ Boolean
38 39 40 41 42 |
# File 'app/controllers/application_controller.rb', line 38 def should_choose_organization? current_user? && current_user.has_accessible_organizations? && Mumukit::Platform.implicit_organization?(request) end |
#should_redirect_to_main_organization? ⇒ Boolean
30 31 32 |
# File 'app/controllers/application_controller.rb', line 30 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
45 46 47 48 |
# File 'app/controllers/application_controller.rb', line 45 def validate_accessible! return if current_user&.teacher_here? accessible_subject.validate_accessible_for! current_user end |