dradis-plugins 3.17.0 → 3.18.0

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
  SHA256:
3
- metadata.gz: 63c73b9308963a281e182f68ce2eaaa1d1da5c0dab9fb3a042e63ff9f6f4668d
4
- data.tar.gz: b7d3cab673e307dc688828d9a1735295e6d1da9e1c4450aab4f4210993163e03
3
+ metadata.gz: 8cd3c416bb51bcacabac80210bf4e03544aca51ad0705e9280e6e866f9b6998f
4
+ data.tar.gz: c1f0b3a39453af29e14b2cd15799f8a146270f06a53f19020b1de3ae5323c2ad
5
5
  SHA512:
6
- metadata.gz: 0d557b0eb64458639b1ec6df6ddf38977e017eb0a0f4bf14d5b18b1e3265295b5753dd79dfe757bbade80ec46d8786ab8daeeb2373240cf838ddb6bf4e109702
7
- data.tar.gz: 0547b4ca3771a9f2aa8db971295292063a5a9ff6afb67dd89cc6a2d92393ae27ca6ba8bb452ef553fe75f04cb783f0ba4900084c80cc47ce2c15cb2fe9427e41
6
+ metadata.gz: 3b6ea9b445c8a7e8df92a19eb9f043c981736ae3235ebfd90b941af3280ef104ed1dbda787d259daa5dc1c6259c5e8175e478e9f397d7265c5bc38767a59b747
7
+ data.tar.gz: 864ec192114ff23648e2872c583ba13d40520c807e78032731082bcb036f38240c10ed1ccec6624cace77e9131f1365ffd5fab312fabfbb858ef5ca79a29779d
@@ -1,3 +1,7 @@
1
+ ## Dradis Framework 3.18 (July, 2020) ##
2
+
3
+ * Added PersistentPermissions module to dry up permissions endpoints.
4
+
1
5
  ## Dradis Framework 3.17 (May, 2020) ##
2
6
 
3
7
  * No changes.
@@ -0,0 +1,43 @@
1
+ module Dradis
2
+ module Plugins
3
+ module PersistentPermissions
4
+ extend ActiveSupport::Concern
5
+
6
+ def update
7
+ @user = User.authors.find(params[:id])
8
+
9
+ Permission.transaction do
10
+ Permission.where(component: self.class.component_name, user_id: params[:id]).destroy_all
11
+
12
+ permissions_params[:permissions]&.each do |permission|
13
+ # Validate the permission being created is a valid value
14
+ next unless self.class.permissions_validation.call(permission) if self.class.permissions_validation
15
+
16
+ Permission.create!(
17
+ component: self.class.component_name,
18
+ name: permission,
19
+ user_id: params[:id]
20
+ )
21
+ end
22
+ end
23
+
24
+ redirect_to main_app.edit_admin_user_permissions_path(params[:id]), notice: "#{@user.name}'s permissions have been updated."
25
+ end
26
+
27
+ private
28
+
29
+ def permissions_params
30
+ params.require(self.class.component_name).permit(permissions: [])
31
+ end
32
+
33
+ class_methods do
34
+ attr_accessor :component_name, :permissions_validation
35
+
36
+ def permissible_tool(component_name, opts = {})
37
+ self.component_name = component_name
38
+ self.permissions_validation = opts[:validation]
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -7,7 +7,7 @@ module Dradis
7
7
 
8
8
  module VERSION
9
9
  MAJOR = 3
10
- MINOR = 17
10
+ MINOR = 18
11
11
  TINY = 0
12
12
  PRE = nil
13
13
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dradis-plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.17.0
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-02 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,6 +67,7 @@ files:
67
67
  - LICENSE
68
68
  - README.md
69
69
  - Rakefile
70
+ - app/controllers/concerns/dradis/plugins/persistent_permissions.rb
70
71
  - app/controllers/dradis/plugins/export/base_controller.rb
71
72
  - dradis-plugins.gemspec
72
73
  - lib/dradis-plugins.rb
@@ -125,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
126
  - !ruby/object:Gem::Version
126
127
  version: '0'
127
128
  requirements: []
128
- rubygems_version: 3.0.1
129
+ rubygems_version: 3.1.2
129
130
  signing_key:
130
131
  specification_version: 4
131
132
  summary: Plugin manager for the Dradis Framework project.