annotation_security 1.0.1
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/CHANGELOG +2 -0
- data/HOW-TO +261 -0
- data/MIT-LICENSE +18 -0
- data/README +39 -0
- data/Rakefile +56 -0
- data/assets/app/helpers/annotation_security_helper.rb +9 -0
- data/assets/config/initializers/annotation_security.rb +12 -0
- data/assets/config/security/relations.rb +20 -0
- data/assets/config/security/rights.yml +16 -0
- data/assets/vendor/plugins/annotation_security/init.rb +14 -0
- data/bin/annotation_security +8 -0
- data/lib/annotation_security/exceptions.rb +125 -0
- data/lib/annotation_security/exec.rb +189 -0
- data/lib/annotation_security/filters.rb +38 -0
- data/lib/annotation_security/includes/action_controller.rb +144 -0
- data/lib/annotation_security/includes/active_record.rb +28 -0
- data/lib/annotation_security/includes/helper.rb +215 -0
- data/lib/annotation_security/includes/resource.rb +85 -0
- data/lib/annotation_security/includes/role.rb +31 -0
- data/lib/annotation_security/includes/user.rb +27 -0
- data/lib/annotation_security/manager/policy_factory.rb +30 -0
- data/lib/annotation_security/manager/policy_manager.rb +80 -0
- data/lib/annotation_security/manager/relation_loader.rb +273 -0
- data/lib/annotation_security/manager/resource_manager.rb +36 -0
- data/lib/annotation_security/manager/right_loader.rb +88 -0
- data/lib/annotation_security/model_observer.rb +61 -0
- data/lib/annotation_security/policy/abstract_policy.rb +345 -0
- data/lib/annotation_security/policy/abstract_static_policy.rb +76 -0
- data/lib/annotation_security/policy/all_resources_policy.rb +21 -0
- data/lib/annotation_security/policy/rule.rb +340 -0
- data/lib/annotation_security/policy/rule_set.rb +139 -0
- data/lib/annotation_security/rails.rb +39 -0
- data/lib/annotation_security/user_wrapper.rb +74 -0
- data/lib/annotation_security/utils.rb +142 -0
- data/lib/annotation_security.rb +98 -0
- data/lib/extensions/action_controller.rb +33 -0
- data/lib/extensions/active_record.rb +35 -0
- data/lib/extensions/filter.rb +134 -0
- data/lib/extensions/object.rb +11 -0
- data/lib/security_context.rb +551 -0
- data/spec/annotation_security/exceptions_spec.rb +17 -0
- data/spec/annotation_security/includes/helper_spec.rb +82 -0
- data/spec/annotation_security/manager/policy_manager_spec.rb +15 -0
- data/spec/annotation_security/manager/resource_manager_spec.rb +17 -0
- data/spec/annotation_security/manager/right_loader_spec.rb +17 -0
- data/spec/annotation_security/policy/abstract_policy_spec.rb +17 -0
- data/spec/annotation_security/policy/all_resources_policy_spec.rb +24 -0
- data/spec/annotation_security/policy/rule_set_spec.rb +112 -0
- data/spec/annotation_security/policy/rule_spec.rb +78 -0
- data/spec/annotation_security/policy/test_policy_spec.rb +81 -0
- data/spec/annotation_security/security_context_spec.rb +78 -0
- data/spec/annotation_security/utils_spec.rb +74 -0
- data/spec/helper/test_controller.rb +66 -0
- data/spec/helper/test_helper.rb +5 -0
- data/spec/helper/test_relations.rb +7 -0
- data/spec/helper/test_resource.rb +39 -0
- data/spec/helper/test_rights.yml +5 -0
- data/spec/helper/test_role.rb +22 -0
- data/spec/helper/test_user.rb +32 -0
- data/spec/rails_stub.rb +38 -0
- data/spec/spec_helper.rb +43 -0
- metadata +157 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
# Make sure this file is only loaded once.
|
3
|
+
if Object.const_defined? 'AnnotationSecuritySpecHelper'
|
4
|
+
# If this happens, some requires or settings are wrong
|
5
|
+
raise 'Reloading AnnotationSecurity Spec Helper'
|
6
|
+
end
|
7
|
+
puts 'Initializing AnnotationSecurity Spec'
|
8
|
+
AnnotationSecuritySpecHelper = true
|
9
|
+
|
10
|
+
|
11
|
+
dir = File.dirname(__FILE__)
|
12
|
+
|
13
|
+
require 'spec'
|
14
|
+
require 'mocha'
|
15
|
+
require 'rails_stub'
|
16
|
+
require 'action_annotation'
|
17
|
+
require dir + '/../lib/annotation_security'
|
18
|
+
|
19
|
+
module AnnotationSecurity
|
20
|
+
# some modifications on the initializer
|
21
|
+
def self.init_rails(dir)
|
22
|
+
%w{extensions/object extensions/action_controller extensions/active_record
|
23
|
+
extensions/filter }.each { |f| require dir + f }
|
24
|
+
AnnotationSecurity.load_relations(dir +
|
25
|
+
'annotation_security/policy/all_resources_policy')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
require dir + '/helper/test_user'
|
31
|
+
require dir + '/helper/test_role'
|
32
|
+
require dir + '/helper/test_resource'
|
33
|
+
require dir + '/helper/test_controller'
|
34
|
+
require dir + '/helper/test_helper'
|
35
|
+
|
36
|
+
AnnotationSecurity.load_relations(dir + '/helper/test_relations')
|
37
|
+
AnnotationSecurity.load_rights(dir + '/helper/test_rights')
|
38
|
+
|
39
|
+
AnnotationSecurity.init_rails(dir + '/../lib/')
|
40
|
+
|
41
|
+
Spec::Runner.configure do |config|
|
42
|
+
config.mock_with :mocha
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: annotation_security
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nico Rehwaldt, Arian Treffer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-03-13 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: action_annotation
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.1
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.3.5
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.2.0
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: mocha
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.8
|
54
|
+
version:
|
55
|
+
description: AnnotationSecurity provides a role based security model with automated rule evaluation for Ruby on Rails. It allows you to define user-resource-relations and rights in separate files, keeping your controllers and views free from any security logic. See the gem's homepage for an example.
|
56
|
+
email: ruby@nixis.de
|
57
|
+
executables:
|
58
|
+
- annotation_security
|
59
|
+
extensions: []
|
60
|
+
|
61
|
+
extra_rdoc_files:
|
62
|
+
- README
|
63
|
+
- MIT-LICENSE
|
64
|
+
- CHANGELOG
|
65
|
+
- HOW-TO
|
66
|
+
files:
|
67
|
+
- CHANGELOG
|
68
|
+
- MIT-LICENSE
|
69
|
+
- README
|
70
|
+
- HOW-TO
|
71
|
+
- Rakefile
|
72
|
+
- bin/annotation_security
|
73
|
+
- lib/annotation_security/exceptions.rb
|
74
|
+
- lib/annotation_security/exec.rb
|
75
|
+
- lib/annotation_security/filters.rb
|
76
|
+
- lib/annotation_security/includes/action_controller.rb
|
77
|
+
- lib/annotation_security/includes/active_record.rb
|
78
|
+
- lib/annotation_security/includes/helper.rb
|
79
|
+
- lib/annotation_security/includes/resource.rb
|
80
|
+
- lib/annotation_security/includes/role.rb
|
81
|
+
- lib/annotation_security/includes/user.rb
|
82
|
+
- lib/annotation_security/manager/policy_factory.rb
|
83
|
+
- lib/annotation_security/manager/policy_manager.rb
|
84
|
+
- lib/annotation_security/manager/relation_loader.rb
|
85
|
+
- lib/annotation_security/manager/resource_manager.rb
|
86
|
+
- lib/annotation_security/manager/right_loader.rb
|
87
|
+
- lib/annotation_security/model_observer.rb
|
88
|
+
- lib/annotation_security/policy/abstract_policy.rb
|
89
|
+
- lib/annotation_security/policy/abstract_static_policy.rb
|
90
|
+
- lib/annotation_security/policy/all_resources_policy.rb
|
91
|
+
- lib/annotation_security/policy/rule.rb
|
92
|
+
- lib/annotation_security/policy/rule_set.rb
|
93
|
+
- lib/annotation_security/rails.rb
|
94
|
+
- lib/annotation_security/user_wrapper.rb
|
95
|
+
- lib/annotation_security/utils.rb
|
96
|
+
- lib/annotation_security.rb
|
97
|
+
- lib/extensions/action_controller.rb
|
98
|
+
- lib/extensions/active_record.rb
|
99
|
+
- lib/extensions/filter.rb
|
100
|
+
- lib/extensions/object.rb
|
101
|
+
- lib/security_context.rb
|
102
|
+
- spec/annotation_security/exceptions_spec.rb
|
103
|
+
- spec/annotation_security/includes/helper_spec.rb
|
104
|
+
- spec/annotation_security/manager/policy_manager_spec.rb
|
105
|
+
- spec/annotation_security/manager/resource_manager_spec.rb
|
106
|
+
- spec/annotation_security/manager/right_loader_spec.rb
|
107
|
+
- spec/annotation_security/policy/abstract_policy_spec.rb
|
108
|
+
- spec/annotation_security/policy/all_resources_policy_spec.rb
|
109
|
+
- spec/annotation_security/policy/rule_set_spec.rb
|
110
|
+
- spec/annotation_security/policy/rule_spec.rb
|
111
|
+
- spec/annotation_security/policy/test_policy_spec.rb
|
112
|
+
- spec/annotation_security/security_context_spec.rb
|
113
|
+
- spec/annotation_security/utils_spec.rb
|
114
|
+
- spec/helper/test_controller.rb
|
115
|
+
- spec/helper/test_helper.rb
|
116
|
+
- spec/helper/test_relations.rb
|
117
|
+
- spec/helper/test_resource.rb
|
118
|
+
- spec/helper/test_rights.yml
|
119
|
+
- spec/helper/test_role.rb
|
120
|
+
- spec/helper/test_user.rb
|
121
|
+
- spec/rails_stub.rb
|
122
|
+
- spec/spec_helper.rb
|
123
|
+
- assets/app/helpers/annotation_security_helper.rb
|
124
|
+
- assets/config/initializers/annotation_security.rb
|
125
|
+
- assets/config/security/relations.rb
|
126
|
+
- assets/config/security/rights.yml
|
127
|
+
- assets/vendor/plugins/annotation_security/init.rb
|
128
|
+
has_rdoc: true
|
129
|
+
homepage: http://tech.lefedt.de/2010/3/annotation-based-security-for-rails
|
130
|
+
licenses: []
|
131
|
+
|
132
|
+
post_install_message:
|
133
|
+
rdoc_options: []
|
134
|
+
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: "0"
|
142
|
+
version:
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: "0"
|
148
|
+
version:
|
149
|
+
requirements: []
|
150
|
+
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 1.3.5
|
153
|
+
signing_key:
|
154
|
+
specification_version: 3
|
155
|
+
summary: A role based security model for rails applications with descriptive definitions and automated evaluation.
|
156
|
+
test_files: []
|
157
|
+
|