mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
21 lines
526 B
Ruby
21 lines
526 B
Ruby
class ApplicationController < ActionController::Base
|
|
protect_from_forgery
|
|
|
|
def is_logged_in?
|
|
session[:user]
|
|
end
|
|
|
|
def redirect_if_not_logged_in
|
|
unless is_logged_in?
|
|
redirect_to homepage_path, :notice => "You must be logged in to do that!"
|
|
end
|
|
end
|
|
|
|
def require_ownership_of_character
|
|
character = Character.find(params[:id])
|
|
unless session[:user] and session[:user] == character.user.id
|
|
redirect_to homepage_path, :notice => "You don't have permission to do that!"
|
|
end
|
|
end
|
|
end
|