Add admin area

This commit is contained in:
2023-05-06 17:11:54 +10:00
parent 08943a3f93
commit c4bd903e74
21 changed files with 258 additions and 5 deletions

View File

@@ -0,0 +1,16 @@
module Adamantium
module Middleware
class BasicAuth < Rack::Auth::Basic
def call(env)
request = Rack::Request.new(env)
if request.path.match(/^\/admin*/)
# Execute basic authentication
super(env)
else
# Pass basic authentication
@app.call(env)
end
end
end
end
end

View File

@@ -6,8 +6,8 @@ module Adamantium
class Tags < ROM::Relation[:sql]
schema :tags, infer: true do
associations do
belongs_to :post_tag
belongs_to :post, through: :post_tag
has_many :post_tags
has_many :posts, through: :post_tags
end
end