diff options
Diffstat (limited to 'src/guff.cr')
-rw-r--r-- | src/guff.cr | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/guff.cr b/src/guff.cr index c1acd8b..3fecd10 100644 --- a/src/guff.cr +++ b/src/guff.cr @@ -1325,35 +1325,6 @@ module Guff end end - class Context - getter :config, :dbs - - def initialize(@config : Config) - @dbs = DatabasePair.new(@config.db_path, development?) - end - - def models - @models ||= ModelSet.new(self) - end - - def session - @session ||= Session.new(self) - end - - def user_id : Int64? - session["user_id"]? ? session["user_id"].to_i64 : nil - end - - def has_role?(roles : Array(String)) - id = user_id - id ? models.user.has_role?(id, roles) : false - end - - def development? - @is_development ||= (@config.env == "development") as Bool - end - end - module APIs module PostAPI def do_post_get_posts(params : HTTP::Params) |