rails-image-post-solution 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2ec235984ebcb48ca00c9de257a7c8270476ebf7b277eec2a6d2b5597442114
4
- data.tar.gz: d6dad1b4c10d93752525f11c95fad77fe436aab80b8752e28d861a8c5658e753
3
+ metadata.gz: b486c6d4726a0d3774bf530d8fc27e2e5ee22a869535ae635b448991a896c46a
4
+ data.tar.gz: 9a6b640e3f4eb3ca43d9fd202284b0d095d1bd7c1d3be4d57b319f69489a173c
5
5
  SHA512:
6
- metadata.gz: 04356a80b8bc3dd7340a2a657430b16f1d1c70b56a0025e3af525f3333e35968b83a9497b7e0ea35917481dfe20e339b2eb4b3a5e098838e7e2f64d29193c99f
7
- data.tar.gz: e93cd8685eefed70b6445911ae27ec266ac78567b502a5e96120cb94c63b95127d4bbf98f4ba04047e14e22ebe84cec64605dd9671df956c7d771cdb60daebf7
6
+ metadata.gz: 318733add4a1dfc760608aefc72f5ff7e54888a832dcaa9bf15c9d4a8437d426ccde18ef4c9ffa5e2d8158d1131e849a89b927794ed16e758b70ba9401d1ad6f
7
+ data.tar.gz: 872cec66f1cf53510f13e6de9ac3075997a875a3c1ce1669daa24c2f04b587ec548e9170f11db2c173ae4a98ff74d53997355092fb0f8dc4ba04d23c639003f5
@@ -4,5 +4,24 @@ module RailsImagePostSolution
4
4
  class ApplicationController < ::ApplicationController
5
5
  # Engine's base controller inherits from host application's ApplicationController
6
6
  # This allows the engine to use the host app's authentication methods
7
+
8
+ # Override require_login to use main_app routes
9
+ def require_login
10
+ unless logged_in?
11
+ redirect_to main_app.login_path, alert: I18n.t("errors.messages.login_required")
12
+ end
13
+ end
14
+
15
+ # Add require_admin method for admin controllers
16
+ def require_admin
17
+ unless logged_in?
18
+ redirect_to main_app.login_path, alert: I18n.t("errors.messages.login_required")
19
+ return
20
+ end
21
+
22
+ unless current_user.admin?
23
+ redirect_to main_app.root_path, alert: I18n.t("errors.messages.admin_required")
24
+ end
25
+ end
7
26
  end
8
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsImagePostSolution
4
- VERSION = "0.1.13"
4
+ VERSION = "0.1.14"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-image-post-solution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler