acts_as_authoritah 2.0.3 → 2.0.4
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.
- data/Gemfile +0 -1
- data/lib/acts_as_authoritah/acl_loader.rb +1 -1
- data/lib/acts_as_authoritah/spreadsheets/spreadsheet_reader.rb +1 -2
- data/lib/acts_as_authoritah/version.rb +1 -1
- data/lib/acts_as_authoritah.rb +1 -2
- data/spec/acts_as_authoritah/spreadsheets/spreadsheet_reader_spec.rb +5 -5
- data/spec/acts_as_authoritah/spreadsheets/spreadsheet_wrapper_spec.rb +2 -2
- data/spec/data/archived.csv +1 -0
- data/spec/data/default.csv +1 -0
- data/spec/data/unpublished.csv +1 -0
- metadata +12 -12
- data/spec/data/archived.xls +0 -0
- data/spec/data/default.xls +0 -0
- data/spec/data/unpublished.xls +0 -0
data/Gemfile
CHANGED
data/lib/acts_as_authoritah.rb
CHANGED
@@ -13,8 +13,7 @@ require "acts_as_authoritah/acl_loader"
|
|
13
13
|
require "acts_as_authoritah/identifier_parser"
|
14
14
|
require "acts_as_authoritah/errors.rb"
|
15
15
|
|
16
|
-
require '
|
17
|
-
Spreadsheet.client_encoding = 'UTF-8'
|
16
|
+
require 'csv'
|
18
17
|
|
19
18
|
require "acts_as_authoritah/spreadsheets/access_rights_mapper"
|
20
19
|
require "acts_as_authoritah/spreadsheets/spreadsheet_wrapper"
|
@@ -2,20 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ActsAsAuthoritah::SpreadsheetReader do
|
4
4
|
it "should be able to open a spreadsheet give a valid path" do
|
5
|
-
ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.
|
5
|
+
ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.csv").valid?.should eq true
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should be invalid if file not found" do
|
9
|
-
ActsAsAuthoritah::SpreadsheetReader.new("spec/data/no_such_file.
|
9
|
+
ActsAsAuthoritah::SpreadsheetReader.new("spec/data/no_such_file.csv").valid?.should eq false
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should return all valid rows (skip first row and other empty rows)" do
|
13
|
-
reader = ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.
|
13
|
+
reader = ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.csv")
|
14
14
|
reader.valid_rows.count.should eq 2
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should returns rows in the expected format" do
|
18
|
-
reader = ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.
|
18
|
+
reader = ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.csv")
|
19
19
|
reader.valid_rows.should eq [
|
20
20
|
["scope1::scope2", "Dummy", "edit", "test", "x", nil, "x"],
|
21
21
|
["scope3::scope4", "Another", "update", "test", nil, "x", "x"]
|
@@ -23,7 +23,7 @@ describe ActsAsAuthoritah::SpreadsheetReader do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should return the header row" do
|
26
|
-
reader = ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.
|
26
|
+
reader = ActsAsAuthoritah::SpreadsheetReader.new("spec/data/default.csv")
|
27
27
|
reader.header.should eq ["scope", "controller", "action", "description", "admin", "anonymous", "super_admin"]
|
28
28
|
end
|
29
29
|
end
|
@@ -2,11 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe ActsAsAuthoritah::SpreadsheetWrapper do
|
4
4
|
it "should be able to open a spreadsheet and convert to an array of AccessRules" do
|
5
|
-
ActsAsAuthoritah::SpreadsheetWrapper.new("spec/data/default.
|
5
|
+
ActsAsAuthoritah::SpreadsheetWrapper.new("spec/data/default.csv").to_access_rules.first.class.should eq ActsAsAuthoritah::AccessRule
|
6
6
|
end
|
7
7
|
|
8
8
|
it "should load the spreadsheet to ACL correctly" do
|
9
|
-
access_rules = ActsAsAuthoritah::SpreadsheetWrapper.new("spec/data/default.
|
9
|
+
access_rules = ActsAsAuthoritah::SpreadsheetWrapper.new("spec/data/default.csv").to_access_rules
|
10
10
|
ActsAsAuthoritah::AccessControlList.new(access_rules).store.should eq({
|
11
11
|
"scope1::scope2::DummyController#edit"=>{"admin"=>true, "anonymous"=>false, "super_admin"=>true},
|
12
12
|
"scope3::scope4::AnotherController#update"=>{"admin"=>false, "anonymous"=>true, "super_admin"=>true}
|
@@ -0,0 +1 @@
|
|
1
|
+
scope,controller,action,description,admin,anonymous,super_admin
|
@@ -0,0 +1 @@
|
|
1
|
+
scope,controller,action,description,admin,anonymous,super_admin
|
@@ -0,0 +1 @@
|
|
1
|
+
scope,controller,action,description,admin,anonymous,super_admin,,,,,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_authoritah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156287840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2156287840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &2156287200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156287200
|
36
36
|
description: Define user capabilities in your app
|
37
37
|
email:
|
38
38
|
- unni.tallman@gmail.com
|
@@ -77,9 +77,9 @@ files:
|
|
77
77
|
- spec/acts_as_authoritah/spreadsheets/spreadsheet_reader_spec.rb
|
78
78
|
- spec/acts_as_authoritah/spreadsheets/spreadsheet_row_parser_spec.rb
|
79
79
|
- spec/acts_as_authoritah/spreadsheets/spreadsheet_wrapper_spec.rb
|
80
|
-
- spec/data/archived.
|
81
|
-
- spec/data/default.
|
82
|
-
- spec/data/unpublished.
|
80
|
+
- spec/data/archived.csv
|
81
|
+
- spec/data/default.csv
|
82
|
+
- spec/data/unpublished.csv
|
83
83
|
- spec/spec_helper.rb
|
84
84
|
homepage: ''
|
85
85
|
licenses: []
|
@@ -119,7 +119,7 @@ test_files:
|
|
119
119
|
- spec/acts_as_authoritah/spreadsheets/spreadsheet_reader_spec.rb
|
120
120
|
- spec/acts_as_authoritah/spreadsheets/spreadsheet_row_parser_spec.rb
|
121
121
|
- spec/acts_as_authoritah/spreadsheets/spreadsheet_wrapper_spec.rb
|
122
|
-
- spec/data/archived.
|
123
|
-
- spec/data/default.
|
124
|
-
- spec/data/unpublished.
|
122
|
+
- spec/data/archived.csv
|
123
|
+
- spec/data/default.csv
|
124
|
+
- spec/data/unpublished.csv
|
125
125
|
- spec/spec_helper.rb
|
data/spec/data/archived.xls
DELETED
Binary file
|
data/spec/data/default.xls
DELETED
Binary file
|
data/spec/data/unpublished.xls
DELETED
Binary file
|