#back_url ⇒ Object

#check_if_login_required ⇒ Object

check if login is globally required to access the application

99
100
101
102
103

# File 'app/controllers/application_controller.rb', line 99defcheck_if_login_required# no check needed if user is already logged in
returntrueifUser.current.logged?require_loginifSetting.login_required?end

#check_project_privacy ⇒ Object

make sure that the user is a member of the project (or admin) if project is
private used as a before_filter for actions that do not require any
particular permission on the project

#default_template(action_name = self.action_name) ⇒ Object

Overrides #default_template so that the api template is used automatically
if it exists

465
466
467
468
469
470
471
472
473
474
475

# File 'app/controllers/application_controller.rb', line 465defdefault_template(action_name=self.action_name)ifapi_request?beginreturnself.view_paths.find_template(default_template_name(action_name),'api')rescue::ActionView::MissingTemplate# the api template was not found
# fallback to the default behaviour
endendsuperend

#invalid_authenticity_token ⇒ Object

313
314
315
316
317
318

# File 'app/controllers/application_controller.rb', line 313definvalid_authenticity_tokenifapi_request?logger.error"Form authenticity token is missing or is invalid. API calls must include a proper Content-type header (text/xml or text/json)."endrender_error"Invalid form authenticity token."end

#query_statement_invalid(exception) ⇒ Object

Rescues an invalid query statement. Just in case…

436
437
438
439
440
441

# File 'app/controllers/application_controller.rb', line 436defquery_statement_invalid(exception)logger.error"Query::StatementInvalid: #{exception.message}"ifloggersession.delete(:query)sort_clearifrespond_to?(:sort_clear)render_error"An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."end

#redirect_back_or_default(default) ⇒ Object

259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

# File 'app/controllers/application_controller.rb', line 259defredirect_back_or_default(default)back_url=CGI.unescape(params[:back_url].to_s)if!back_url.blank?beginuri=URI.parse(back_url)# do not redirect user to another host or to the login or register page
if(uri.relative?||(uri.host==request.host))&&!uri.path.match(%r{/(login|account/register)})redirect_to(back_url)returnendrescueURI::InvalidURIError# redirect to default
endendredirect_todefaultend