isaca-rails 0.4.9 → 0.5.3
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 +10 -4
- data/lib/isaca/rails/version.rb +1 -1
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fe2347a3e86e465db9c9ec7730bf2807afc0708311667c165a6b0c51e1c0a93
|
4
|
+
data.tar.gz: 84cfaab2259df97943583d60810b0fb540f6b82b0004f6ac22cbcaf4b64cbd2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55eb6b4c84f4d315ca87869d745fb1bc6c6cfeaa146795839105491ca9aa3c134a8daf814ee9826adaac11c9e27624639318cfaa0c32d3861727236e35a80c11
|
7
|
+
data.tar.gz: c570e50b9fd9811faa85c2453c7bd30904bb391ad43a3599264f359b4363cd046967975a7de29dbedf209d29aa507a0eb183139b46db2a913eec6c3e451d3ee9
|
@@ -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
|
|
@@ -7,8 +7,9 @@ module Isaca
|
|
7
7
|
helper_method :user_has_privilege?
|
8
8
|
end
|
9
9
|
|
10
|
-
def authorize_isaca_user
|
11
|
-
if current_isaca_user.admin?
|
10
|
+
def authorize_isaca_user(user = nil)
|
11
|
+
# if current_isaca_user.admin?
|
12
|
+
if (!user.nil? && user.admin?) || (!current_isaca_user.nil? && current_isaca_user.admin?)
|
12
13
|
if %w(index new show create update destroy).include?(action_name)
|
13
14
|
if %w(index show).include?(action_name)
|
14
15
|
behavior = 'read'
|
@@ -24,7 +25,8 @@ module Isaca
|
|
24
25
|
end
|
25
26
|
|
26
27
|
privilege = "#{behavior}_#{controller_name.underscore}".to_sym
|
27
|
-
unless user_has_privilege?(current_isaca_user, privilege)
|
28
|
+
# unless user_has_privilege?(current_isaca_user, privilege)
|
29
|
+
unless user_has_privilege?(user, privilege)
|
28
30
|
respond_to do |format|
|
29
31
|
message = "#{t('isaca.rails.claims.admin_required')} Missing claim: #{privilege}."
|
30
32
|
|
@@ -59,7 +61,11 @@ module Isaca
|
|
59
61
|
end
|
60
62
|
|
61
63
|
def user_has_privilege?(user, privilege)
|
62
|
-
user.
|
64
|
+
unless user.nil?
|
65
|
+
user.claims.where(privilege: privilege).any?
|
66
|
+
else
|
67
|
+
current_isaca_user.has_privilege?(privilege)
|
68
|
+
end
|
63
69
|
end
|
64
70
|
|
65
71
|
def claim_symbols(claim_params, state)
|
data/lib/isaca/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: isaca-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Orahood
|
8
|
-
|
8
|
+
- Shaun Eutsey
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
@@ -223,6 +224,7 @@ dependencies:
|
|
223
224
|
description: Description of Isaca::Rails.
|
224
225
|
email:
|
225
226
|
- morahood@gmail.com
|
227
|
+
- seutsey@isaca.org
|
226
228
|
executables: []
|
227
229
|
extensions: []
|
228
230
|
extra_rdoc_files: []
|
@@ -285,10 +287,10 @@ files:
|
|
285
287
|
- lib/isaca/rails/user.rb
|
286
288
|
- lib/isaca/rails/version.rb
|
287
289
|
- lib/tasks/isaca/rails_tasks.rake
|
288
|
-
homepage:
|
290
|
+
homepage:
|
289
291
|
licenses: []
|
290
292
|
metadata: {}
|
291
|
-
post_install_message:
|
293
|
+
post_install_message:
|
292
294
|
rdoc_options: []
|
293
295
|
require_paths:
|
294
296
|
- lib
|
@@ -303,8 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
303
305
|
- !ruby/object:Gem::Version
|
304
306
|
version: '0'
|
305
307
|
requirements: []
|
306
|
-
rubygems_version: 3.
|
307
|
-
signing_key:
|
308
|
+
rubygems_version: 3.2.27
|
309
|
+
signing_key:
|
308
310
|
specification_version: 4
|
309
311
|
summary: Summary of Isaca::Rails.
|
310
312
|
test_files: []
|