vigilante 1.0.15 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad7899c501a85ae210e2c3a5fb343c9e74c82fd0
4
- data.tar.gz: 22a8e67940f4324363c1d1b404c2e4a3dddf5d44
3
+ metadata.gz: 65cd0618f1a0a21c3ec6d6c9d01ec843ceccd6fc
4
+ data.tar.gz: 6c85af886163c0d2a0ed54d46b15c81b3846fc19
5
5
  SHA512:
6
- metadata.gz: 46d7595cc78d73918f01edce0f4a2fb05da6ddf1ed4d2408e1a9e7042594862248bae603ee1050f177540db2f0a23bc41e58bb80c9529a3154418c21223a1278
7
- data.tar.gz: 0c5e4f89e1de6b70f523fb4e820ac937b1f04eba2e632de73ebf99ed6ceebcc5c552b639edc7855dcc5f5df5e6ed9e1b769c2a568b7b200c6c8e601b91f649b0
6
+ metadata.gz: f4a67192aa48291e9b67b7681e8c569338591513ac13ba091f6c906ce60af578328db980c1c0deaa584aa7605f37965eeaffd913a608fbb07a04bb83f046a8fa
7
+ data.tar.gz: 880b40e4a515fd03250499857dcc26b2fc1afd86528b9e1f2af173a4945b39c54a0214164cd7f9cb8a9e03f450abfd2adff772741e6ab8070cf3ebc603948087
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.15
1
+ 1.0.16
@@ -1,6 +1,8 @@
1
1
  class Ability < ActiveRecord::Base
2
2
  has_many :ability_permissions
3
3
  has_many :permissions, :through => :ability_permissions
4
+ has_many :authorizations
5
+ has_many :operators, :through => :authorizations
4
6
 
5
7
  accepts_nested_attributes_for :permissions
6
8
  accepts_nested_attributes_for :ability_permissions
@@ -25,8 +25,13 @@ class PermissionHash < HashWithIndifferentAccess
25
25
  self[extent][path] ||= {}
26
26
 
27
27
  allowed_actions = [:index, :show] if allowed_actions.nil? || allowed_actions.empty?
28
+ # always allow edit/update and create/new as a pair (allowing one immediately allows the other)
28
29
  allowed_actions.push(:update) if allowed_actions.include?(:edit) && !allowed_actions.include?(:update)
30
+ allowed_actions.push(:edit) if allowed_actions.include?(:update) && !allowed_actions.include?(:edit)
29
31
  allowed_actions.push(:create) if allowed_actions.include?(:new) && !allowed_actions.include?(:create)
32
+ allowed_actions.push(:new) if allowed_actions.include?(:create) && !allowed_actions.include?(:new)
33
+ allowed_actions.push(:destroy) if allowed_actions.include?(:delete) && !allowed_actions.include?(:destroy)
34
+ allowed_actions.push(:delete) if allowed_actions.include?(:destroy) && !allowed_actions.include?(:delete)
30
35
 
31
36
  allowed_actions.each do |a|
32
37
  self[extent][path][a] = 1
@@ -134,4 +139,4 @@ class PermissionHash < HashWithIndifferentAccess
134
139
  result
135
140
  end
136
141
 
137
- end
142
+ end
@@ -13,12 +13,6 @@ module Vigilante
13
13
  ability = Ability.where("lower(name) = '#{role.downcase}'").first
14
14
  raise StandardError.new("Role #{role} is not converted to a corresponding authorization. It does not exist.") if ability.nil?
15
15
 
16
- # extent_params = {}
17
- # unless extent.nil?
18
- # extent_params[:extent] = extent.id
19
- # extent_params[:extent_type] = extent.class.name
20
- # end
21
-
22
16
  new_authorization = ::Authorization.create(:operator_id => self.id, :ability_id => ability.id)
23
17
  unless extent.nil?
24
18
  new_authorization.add_extent(extent)
@@ -232,4 +226,4 @@ module Vigilante
232
226
  end
233
227
 
234
228
  end
235
- end
229
+ end
data/vigilante.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: vigilante 1.0.15 ruby lib
5
+ # stub: vigilante 1.0.16 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vigilante"
9
- s.version = "1.0.15"
9
+ s.version = "1.0.16"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Nathan Van der Auwera"]
14
- s.date = "2019-06-12"
14
+ s.date = "2020-04-04"
15
15
  s.description = "Vigilante is a db-backed authorisation, completely configurable and dynamic; where permissions can be limited to extents."
16
16
  s.email = "nathan@dixis.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vigilante
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Van der Auwera
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-12 00:00:00.000000000 Z
11
+ date: 2020-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails