lockdown 0.5.22 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.22
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Stone
@@ -9,18 +9,28 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-14 00:00:00 -04:00
12
+ date: 2008-11-15 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rubigen
16
+ name: classy-inheritance
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.3.2
23
+ version: 0.6.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: newgem
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.1.0
24
34
  version:
25
35
  - !ruby/object:Gem::Dependency
26
36
  name: hoe
@@ -30,9 +40,9 @@ dependencies:
30
40
  requirements:
31
41
  - - ">="
32
42
  - !ruby/object:Gem::Version
33
- version: 1.7.0
43
+ version: 1.8.0
34
44
  version:
35
- description: Authorization/Authentication system for RubyOnRails
45
+ description: Lockdown is a authentication/authorization system for RubyOnRails. (Merb compatibility coming soon). For more information please visit stonean.com
36
46
  email:
37
47
  - andy@stonean.com
38
48
  executables:
@@ -51,7 +61,6 @@ files:
51
61
  - License.txt
52
62
  - Manifest.txt
53
63
  - PostInstall.txt
54
- - README
55
64
  - README.txt
56
65
  - Rakefile
57
66
  - app_generators/lockdown/USAGE
@@ -59,17 +68,23 @@ files:
59
68
  - app_generators/lockdown/templates/init.rb
60
69
  - app_generators/lockdown/templates/session.rb
61
70
  - bin/lockdown
62
- - config/hoe.rb
63
- - config/requirements.rb
64
71
  - lib/lockdown.rb
65
72
  - lib/lockdown/classy-inheritance.rb
66
73
  - lib/lockdown/controller.rb
67
- - lib/lockdown/controller_inspector.rb
74
+ - lib/lockdown/database.rb
75
+ - lib/lockdown/frameworks/merb.rb
76
+ - lib/lockdown/frameworks/merb/controller.rb
77
+ - lib/lockdown/frameworks/merb/view.rb
78
+ - lib/lockdown/frameworks/rails.rb
79
+ - lib/lockdown/frameworks/rails/controller.rb
80
+ - lib/lockdown/frameworks/rails/view.rb
68
81
  - lib/lockdown/helper.rb
69
- - lib/lockdown/model.rb
82
+ - lib/lockdown/orms/active_record.rb
83
+ - lib/lockdown/orms/data_mapper.rb
84
+ - lib/lockdown/rights.rb
85
+ - lib/lockdown/session.rb
70
86
  - lib/lockdown/system.rb
71
87
  - lib/lockdown/version.rb
72
- - lib/lockdown/view.rb
73
88
  - rails_generators/lockdown/USAGE
74
89
  - rails_generators/lockdown/lockdown_generator.rb
75
90
  - rails_generators/lockdown/templates/app/controllers/permissions_controller.rb
@@ -109,9 +124,6 @@ files:
109
124
  - script/generate
110
125
  - script/txt2html
111
126
  - setup.rb
112
- - tasks/deployment.rake
113
- - tasks/environment.rake
114
- - tasks/website.rake
115
127
  - test/test_generator_helper.rb
116
128
  - test/test_helper.rb
117
129
  - test/test_lockdown.rb
@@ -125,11 +137,8 @@ files:
125
137
  - website/stylesheets/screen.css
126
138
  - website/template.html.erb
127
139
  has_rdoc: true
128
- homepage: http://lockdown.rubyforge.org
129
- post_install_message: |+
130
-
131
- For more information on lockdown, see http://stonean.com
132
-
140
+ homepage: http://stonean.com/wiki/lockdown
141
+ post_install_message: PostInstall.txt
133
142
  rdoc_options:
134
143
  - --main
135
144
  - README.txt
@@ -153,7 +162,7 @@ rubyforge_project: lockdown
153
162
  rubygems_version: 1.2.0
154
163
  signing_key:
155
164
  specification_version: 2
156
- summary: Authorization/Authentication system for RubyOnRails
165
+ summary: Lockdown is a authentication/authorization system for RubyOnRails
157
166
  test_files:
158
167
  - test/test_generator_helper.rb
159
168
  - test/test_helper.rb
data/README DELETED
File without changes
data/config/hoe.rb DELETED
@@ -1,74 +0,0 @@
1
- require 'lockdown/version'
2
-
3
- AUTHOR = 'Andrew Stone' # can also be an array of Authors
4
- EMAIL = "andy@stonean.com"
5
- DESCRIPTION = "Authorization/Authentication system for RubyOnRails"
6
- GEM_NAME = 'lockdown' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = 'lockdown' # The unix name for your project
8
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
- DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
- EXTRA_DEPENDENCIES = [
11
- ['rubigen', '>=1.3.2']
12
- # ['activesupport', '>= 1.3.1']
13
- ] # An array of rubygem dependencies [name, version]
14
-
15
- @config_file = "~/.rubyforge/user-config.yml"
16
- @config = nil
17
- RUBYFORGE_USERNAME = "astone"
18
- def rubyforge_username
19
- unless @config
20
- begin
21
- @config = YAML.load(File.read(File.expand_path(@config_file)))
22
- rescue
23
- puts <<-EOS
24
- ERROR: No rubyforge config file found: #{@config_file}
25
- Run 'rubyforge setup' to prepare your env for access to Rubyforge
26
- - See http://newgem.rubyforge.org/rubyforge.html for more details
27
- EOS
28
- exit
29
- end
30
- end
31
- RUBYFORGE_USERNAME.replace @config["username"]
32
- end
33
-
34
-
35
- REV = nil
36
- # UNCOMMENT IF REQUIRED:
37
- # REV = YAML.load(`svn info`)['Revision']
38
- VERS = Lockdown::VERSION::STRING + (REV ? ".#{REV}" : "")
39
- RDOC_OPTS = ['--quiet', '--title', 'lockdown documentation',
40
- "--opname", "index.html",
41
- "--line-numbers",
42
- "--main", "README",
43
- "--inline-source"]
44
-
45
- class Hoe
46
- def extra_deps
47
- @extra_deps.reject! { |x| Array(x).first == 'hoe' }
48
- @extra_deps
49
- end
50
- end
51
-
52
- # Generate all the Rake tasks
53
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
54
- $hoe = Hoe.new(GEM_NAME, VERS) do |p|
55
- p.developer(AUTHOR, EMAIL)
56
- p.description = DESCRIPTION
57
- p.summary = DESCRIPTION
58
- p.url = HOMEPATH
59
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
60
- p.test_globs = ["test/**/test_*.rb"]
61
- p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
62
-
63
- # == Optional
64
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
65
- p.extra_deps = EXTRA_DEPENDENCIES
66
-
67
- #p.spec_extras = {} # A hash of extra values to set in the gemspec.
68
- end
69
-
70
- CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
71
- PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
72
- $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
73
- $hoe.rsync_args = '-av --delete --ignore-errors'
74
- $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -1,15 +0,0 @@
1
- require 'fileutils'
2
- include FileUtils
3
-
4
- require 'rubygems'
5
- %w[rake hoe newgem rubigen].each do |req_gem|
6
- begin
7
- require req_gem
8
- rescue LoadError
9
- puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
- puts "Installation: gem install #{req_gem} -y"
11
- exit
12
- end
13
- end
14
-
15
- $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
@@ -1,98 +0,0 @@
1
- module Lockdown
2
- module ControllerInspector
3
- def self.included(base)
4
- if Lockdown.merb_app?
5
- base.send :include, Lockdown::ControllerInspector::Merb
6
- elsif Lockdown.rails_app?
7
- base.send :include, Lockdown::ControllerInspector::Rails
8
- end
9
- end
10
-
11
- module Core
12
- include Lockdown::Helper
13
- #
14
- # *syms is a splat of controller symbols,
15
- # e.g all_methods(:users, :authors, :books)
16
- #
17
- def all_methods(*syms)
18
- syms.collect{ |sym| paths_for(sym) }.flatten
19
- end
20
-
21
- #
22
- # controller name (sym) and a splat of methods to
23
- # exclude from result
24
- #
25
- # All user methods except destroy:
26
- # e.g all_except_methods(:users, :destroy)
27
- #
28
- def all_except_methods(sym, *methods)
29
- paths_for(sym) - paths_for(sym, *methods)
30
- end
31
-
32
- #
33
- # controller name (sym) and a splat of methods to
34
- # to build the result
35
- #
36
- # Only user methods index (list), show (good for readonly access):
37
- # e.g only_methods(:users, :index, :show)
38
- #
39
- def only_methods(sym, *methods)
40
- paths_for(sym, *methods)
41
- end
42
-
43
- #
44
- # all controllers, all actions
45
- #
46
- # This is admin access
47
- #
48
- def all_controllers
49
- controllers = Lockdown::System.controller_classes
50
-
51
- controllers.collect do |controller|
52
- methods = available_actions(controller)
53
- paths_for(controller_name(controller), methods)
54
- end.flatten!
55
- end
56
-
57
- private
58
-
59
- def paths_for(str_sym, *methods)
60
- str = str_sym.to_s if str_sym.is_a?(Symbol)
61
- if methods.empty?
62
- klass = Lockdown::System.fetch_controller_class(str)
63
- methods = available_actions(klass)
64
- end
65
- methods.collect{|meth| ctr_path(str) + "/" + meth.to_s }
66
- end
67
-
68
- def ctr_path(str)
69
- str.gsub("__","\/")
70
- end
71
-
72
- #
73
- # Luckily both Rails and Merb have the controller_name method. This
74
- # is here in case that changes.
75
- #
76
- def controller_name(klass)
77
- klass.controller_name
78
- end
79
- end #Core
80
-
81
- module Rails #:nodoc:
82
- include Lockdown::ControllerInspector::Core
83
-
84
- def available_actions(klass)
85
- klass.public_instance_methods - klass.hidden_actions
86
- end
87
- end # Rails
88
-
89
- module Merb #:nodoc:
90
- include Lockdown::ControllerInspector::Core
91
-
92
- def available_actions(klass)
93
- klass.callable_actions.keys
94
- end
95
-
96
- end # Merb
97
- end # ControllerInspector
98
- end # Lockdown
@@ -1,37 +0,0 @@
1
- module Lockdown
2
- module Model
3
- def self.included(base)
4
- base.send :include, Lockdown::Model::InstanceMethods
5
- end
6
-
7
- module InstanceMethods
8
- def self.included(base)
9
- base.class_eval do
10
- alias_method :create_without_stamps, :create
11
- alias_method :create, :create_with_stamps
12
- alias_method :update_without_stamps, :update
13
- alias_method :update, :update_with_stamps
14
- end
15
- end
16
-
17
- def current_profile_id
18
- Thread.current[:profile_id]
19
- end
20
-
21
- def create_with_stamps
22
- profile_id = current_profile_id || Profile::SYSTEM
23
- self[:created_by] = profile_id if self.respond_to?(:created_by)
24
- self[:updated_by] = profile_id if self.respond_to?(:updated_by)
25
- create_without_stamps
26
- end
27
-
28
- def update_with_stamps
29
- profile_id = current_profile_id || Profile::SYSTEM
30
- self[:updated_by] = profile_id if self.respond_to?(:updated_by)
31
- update_without_stamps
32
- end
33
- end # InstanceMethods
34
- end # Model
35
- end # Lockdown
36
-
37
- Lockdown.orm_parent.send :include, Lockdown::Model
data/lib/lockdown/view.rb DELETED
@@ -1,84 +0,0 @@
1
- module Lockdown
2
- module View
3
- module Core
4
- def links(*lis)
5
- rvalue = []
6
- lis.each{|link| rvalue << link if link.length > 0 }
7
- rvalue.join(" | ")
8
- end
9
- end # Core
10
-
11
- module Merb
12
- include Lockdown::View::Core
13
- def self.included(base)
14
- base.send :alias_method, :link_to_open, :link_to
15
- base.send :alias_method, :link_to, :link_to_secured
16
- end
17
-
18
- def link_to_secured(name, url = '', options = {})
19
- if authorized? url
20
- return link_to_open(name, url, options)
21
- end
22
- return ""
23
- end
24
-
25
- def link_to_or_show(name, url = '', options = {})
26
- lnk = link_to(name, url , options)
27
- lnk.length == 0 ? name : lnk
28
- end
29
- end # Merb
30
-
31
- module Rails
32
- include Lockdown::View::Core
33
- def self.included(base)
34
- base.send :alias_method, :link_to_open, :link_to
35
- base.send :alias_method, :link_to, :link_to_secured
36
-
37
- base.send :alias_method, :button_to_open, :button_to
38
- base.send :alias_method, :button_to, :button_to_secured
39
- end
40
-
41
- def link_to_secured(name, options = {}, html_options = nil)
42
- # Don't want to go through the url_for twice
43
- url = url_for(options)
44
- if authorized? test_path(url, html_options)
45
- return link_to_open(name, url, html_options)
46
- end
47
- return ""
48
- end
49
-
50
- def link_to_or_show(name, options = {}, html_options = nil)
51
- lnk = link_to(name, options, html_options)
52
- lnk.length == 0 ? name : lnk
53
- end
54
-
55
- def button_to_secured(name, options = {}, html_options = nil)
56
- url = url_for(options)
57
- if authorized? test_path(url, html_options)
58
- return button_to_open(name, url, html_options)
59
- end
60
- return ""
61
- end
62
-
63
- private
64
-
65
- def test_path(url, html_options)
66
- if html_options.is_a?(Hash) && html_options[:method] == :delete
67
- url += "/destroy"
68
- elsif url.split("/").last =~ /\A\d+\z/
69
- url += "/show"
70
- end
71
- url
72
- end
73
- end # Rails
74
- end # View
75
- end # Lockdown
76
-
77
- if Object.const_defined?("Merb") && Merb.const_defined?("AssetsMixin")
78
- Merb::AssetsMixin.send :include, Lockdown::View::Merb
79
- elsif Object.const_defined?("ActionView")
80
- ActionView::Base.send :include, Lockdown::View::Rails
81
- else
82
- raise NotImplementedError, "Application helper unknown to Lockdown."
83
- end
84
-
@@ -1,34 +0,0 @@
1
- desc 'Release the website and new gem version'
2
- task :deploy => [:check_version, :website, :release] do
3
- puts "Remember to create SVN tag:"
4
- puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
- "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
- puts "Suggested comment:"
7
- puts "Tagging release #{CHANGES}"
8
- end
9
-
10
- desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
- task :local_deploy => [:website_generate, :install_gem]
12
-
13
- task :check_version do
14
- unless ENV['VERSION']
15
- puts 'Must pass a VERSION=x.y.z release version'
16
- exit
17
- end
18
- unless ENV['VERSION'] == VERS
19
- puts "Please update your version.rb to match the release version, currently #{VERS}"
20
- exit
21
- end
22
- end
23
-
24
- desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
- task :install_gem_no_doc => [:clean, :package] do
26
- sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
- end
28
-
29
- namespace :manifest do
30
- desc 'Recreate Manifest.txt to include ALL files'
31
- task :refresh do
32
- `rake check_manifest | patch -p0 > Manifest.txt`
33
- end
34
- end
@@ -1,7 +0,0 @@
1
- task :ruby_env do
2
- RUBY_APP = if RUBY_PLATFORM =~ /java/
3
- "jruby"
4
- else
5
- "ruby"
6
- end unless defined? RUBY_APP
7
- end
data/tasks/website.rake DELETED
@@ -1,17 +0,0 @@
1
- desc 'Generate website files'
2
- task :website_generate => :ruby_env do
3
- (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
- sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
- end
6
- end
7
-
8
- desc 'Upload website files to rubyforge'
9
- task :website_upload do
10
- host = "#{rubyforge_username}@rubyforge.org"
11
- remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
- local_dir = 'website'
13
- sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
- end
15
-
16
- desc 'Generate and upload website files'
17
- task :website => [:website_generate, :website_upload, :publish_docs]