isaca-rails 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/isaca/rails/platform/administrators_controller.rb +3 -0
- data/app/controllers/isaca/rails/sessions_controller.rb +1 -1
- data/lib/isaca/rails/authentication.rb +18 -18
- data/lib/isaca/rails/authorization.rb +6 -2
- data/lib/isaca/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6edd40f7cdd28e7929a11d0403a7f8f7ee34442683be1c3923b2d4e7e5e1d43e
|
4
|
+
data.tar.gz: 34b8a7e2fc4914f8ed8545be148715a3b2ce21e00d6cff14076fd933c46a6d7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d0ba2a3806ee43a63b219ebd0ecfb3a16c780efc6b276eec1c9b47d6b8d4a6bc7d4feccb9d7695fa358490da45fa48937575b3cd793f077b2ddacf825964c3
|
7
|
+
data.tar.gz: 586e2bfe28b264e0be53127bdedb2c1aadeb00b7947a6f89f35750982bc4ab6194f556fd2fac0130f157cabf41924bce24cf724a588d699f52eca7af611d616f
|
@@ -3,6 +3,9 @@ module Isaca
|
|
3
3
|
module Platform
|
4
4
|
class AdministratorsController < ApplicationController
|
5
5
|
def index
|
6
|
+
logger = Logger.new(STDOUT)
|
7
|
+
logger.debug "**** Isaca Rails ****"
|
8
|
+
logger.debug "**** Isaca Rails ****"
|
6
9
|
@administrators = Isaca::Rails.configuration.user_model.where(admin: true)
|
7
10
|
end
|
8
11
|
|
@@ -5,7 +5,7 @@ class Isaca::Rails::SessionsController < Isaca::Rails::ApplicationController
|
|
5
5
|
|
6
6
|
def create
|
7
7
|
begin
|
8
|
-
authenticate(sign_in_params[:username], sign_in_params[:password])
|
8
|
+
# authenticate(sign_in_params[:username], sign_in_params[:password])
|
9
9
|
|
10
10
|
respond_to do |format|
|
11
11
|
format.html do
|
@@ -15,23 +15,23 @@ module Isaca
|
|
15
15
|
#
|
16
16
|
# @return nil
|
17
17
|
def authenticate_isaca_user
|
18
|
-
if user_signed_in?
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
else
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
18
|
+
# if user_signed_in?
|
19
|
+
# if request.path != user_consent_path && redirect_for_consent?
|
20
|
+
# session[:after_sign_in_path] = request.fullpath if request.get? && request.format.html?
|
21
|
+
# flash.alert = t('isaca.rails.user_consent.consent_required')
|
22
|
+
# redirect_to user_consent_path
|
23
|
+
# end
|
24
|
+
# else
|
25
|
+
# session[:after_sign_in_path] = request.fullpath if request.get?
|
26
|
+
# flash.alert = t('isaca.rails.sessions.sign_in_required')
|
27
|
+
|
28
|
+
# respond_to do |format|
|
29
|
+
# format.html {redirect_to sign_in_path}
|
30
|
+
# format.json do
|
31
|
+
# render json: {error: t('isaca.rails.sessions.sign_in_required')}.to_json, status: :unauthorized
|
32
|
+
# end
|
33
|
+
# end
|
34
|
+
# end
|
35
35
|
end
|
36
36
|
|
37
37
|
# A helper method for referencing the user who is currently logged in.
|
@@ -41,7 +41,7 @@ module Isaca
|
|
41
41
|
if @current_isaca_user
|
42
42
|
@current_isaca_user
|
43
43
|
else
|
44
|
-
|
44
|
+
@current_isaca_user = Isaca::Rails.configuration.user_model.find(session[:user_id])
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -9,7 +9,7 @@ module Isaca
|
|
9
9
|
|
10
10
|
def authorize_isaca_user(user = nil)
|
11
11
|
# if current_isaca_user.admin?
|
12
|
-
if user.admin?
|
12
|
+
if (!user.nil? && user.admin?) || (!current_isaca_user.nil? && current_isaca_user.admin?)
|
13
13
|
if %w(index new show create update destroy).include?(action_name)
|
14
14
|
if %w(index show).include?(action_name)
|
15
15
|
behavior = 'read'
|
@@ -61,7 +61,11 @@ module Isaca
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def user_has_privilege?(user, privilege)
|
64
|
-
user.
|
64
|
+
unless user.nil?
|
65
|
+
user.claims.where(privilege: privilege).any?
|
66
|
+
else
|
67
|
+
current_isaca_user.has_privilege?(privilege)
|
68
|
+
end
|
65
69
|
end
|
66
70
|
|
67
71
|
def claim_symbols(claim_params, state)
|
data/lib/isaca/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isaca-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Orahood
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-09-
|
12
|
+
date: 2021-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|