spud_core 0.9.16 → 0.9.17

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -61,3 +61,20 @@ After the tests have completed the current code coverage stats is available by o
61
61
 
62
62
  NOTE: Spud Core is Retina Resolution Compatible Now
63
63
 
64
+ Customizing Authentication
65
+ ---------------------------
66
+
67
+ Authentication resides in an `ActiveSupport::Concern` module called `SpudAuthentication`. This allows you to override the base authlogic configuration or potentially swap it out for another authentication library.
68
+
69
+ To override the base authentication, create a file at `models/concerns/spud_authentication.rb`. Here is an example concern that would configure authlogic to allow users with duplicate email addresses.
70
+
71
+ module Concerns
72
+ module SpudAuthentication
73
+ extend ActiveSupport::Concern
74
+ included do
75
+ acts_as_authentic do |c|
76
+ c.validate_email_field = false
77
+ end
78
+ end
79
+ end
80
+ end
@@ -5,7 +5,7 @@ class Spud::CoreMailer < ActionMailer::Base
5
5
  @user = user
6
6
  @url = edit_spud_password_reset_url(:id => user.perishable_token)
7
7
  # @url = "/spud/password_resets/#{user.perishable_token}/edit"
8
- mail(:from =>Spud::Core.from_address,:to => user.email, :subject => "Forgot Password Request from Spud Site")
8
+ mail(:from =>Spud::Core.from_address,:to => user.email, :subject => "Forgot Password Request from #{Spud::Core.config.site_name}")
9
9
 
10
10
  end
11
11
 
@@ -0,0 +1,10 @@
1
+ module Concerns
2
+ module SpudAuthentication
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ acts_as_authentic do |c|
6
+ # c.my_config_option = my_value # for available options see documentation in: Authlogic::ActsAsAuthentic
7
+ end # block optional
8
+ end
9
+ end
10
+ end
@@ -1,4 +1,6 @@
1
1
  class SpudUser < ActiveRecord::Base
2
+ include Concerns::SpudAuthentication
3
+
2
4
  has_many :spud_admin_permissions,:foreign_key => :user_id
3
5
  has_many :spud_user_settings
4
6
  accepts_nested_attributes_for :spud_admin_permissions, :allow_destroy => true
@@ -6,10 +8,6 @@ class SpudUser < ActiveRecord::Base
6
8
  attr_accessible :login,:email,:first_name,:last_name,:password,:password_confirmation,:password_salt,:last_login_at,:last_request_at,:last_login_ip,:failed_login_count,:current_login_at,:login_count,:persistence_token,:perishable_token,:single_access_token,:crypted_password, :current_login_ip, :created_at, :updated_at,:spud_admin_permissions_attributes,:time_zone, :as => [:default, :admin]
7
9
  attr_accessible :super_admin, :id, :as => :admin
8
10
 
9
- acts_as_authentic do |c|
10
- # c.my_config_option = my_value # for available options see documentation in: Authlogic::ActsAsAuthentic
11
- end # block optional
12
-
13
11
  def has_admin_rights?
14
12
  return self.super_admin || self.spud_admin_permissions.count > 0
15
13
  end
@@ -1,5 +1,5 @@
1
1
  module Spud
2
2
  module Core
3
- VERSION = "0.9.16"
3
+ VERSION = "0.9.17"
4
4
  end
5
5
  end
@@ -1,17 +1,39 @@
1
1
  Connecting to database specified by database.yml
2
-  (0.2ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` 
3
-  (22.6ms) DROP DATABASE IF EXISTS `spud_core_test`
2
+  (65.4ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
3
+  (144.1ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
4
+  (0.3ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` 
5
+ Migrating to CreateSpudAdminPermissions (20111214161011)
6
+  (103.8ms) CREATE TABLE `spud_admin_permissions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255), `access` tinyint(1), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
7
+  (0.8ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20111214161011')
8
+ Migrating to CreateSpudUsers (20111214161146)
9
+  (113.1ms) CREATE TABLE `spud_users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `first_name` varchar(255), `last_name` varchar(255), `super_admin` tinyint(1), `login` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `crypted_password` varchar(255) NOT NULL, `password_salt` varchar(255) NOT NULL, `persistence_token` varchar(255) NOT NULL, `single_access_token` varchar(255) NOT NULL, `perishable_token` varchar(255) NOT NULL, `login_count` int(11) DEFAULT 0 NOT NULL, `failed_login_count` int(11) DEFAULT 0 NOT NULL, `last_request_at` datetime, `current_login_at` datetime, `last_login_at` datetime, `current_login_ip` varchar(255), `last_login_ip` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
10
+  (117.7ms) CREATE INDEX `index_spud_users_on_login` ON `spud_users` (`login`)
11
+  (111.0ms) CREATE INDEX `index_spud_users_on_email` ON `spud_users` (`email`)
12
+  (0.8ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20111214161146')
13
+ Migrating to AddTimeZoneToSpudUser (20120327124229)
14
+  (149.1ms) ALTER TABLE `spud_users` ADD `time_zone` varchar(255)
15
+  (0.5ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20120327124229')
16
+ Migrating to AddScopeToSpudAdminPermissions (20120328235431)
17
+  (130.5ms) ALTER TABLE `spud_admin_permissions` ADD `scope` varchar(255)
18
+  (0.5ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20120328235431')
19
+ Migrating to CreateSpudUserSettings (20120329174000)
20
+  (105.9ms) CREATE TABLE `spud_user_settings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `key` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
21
+  (0.8ms) INSERT INTO `schema_migrations` (`version`) VALUES ('20120329174000')
22
+  (0.3ms) SELECT `schema_migrations`.`version` FROM `schema_migrations`
23
+ Connecting to database specified by database.yml
24
+  (0.3ms) SELECT `schema_migrations`.`version` FROM `schema_migrations` 
25
+  (0.5ms) DROP DATABASE IF EXISTS `spud_core_test`
4
26
   (0.3ms) CREATE DATABASE `spud_core_test` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`
5
-  (23.9ms) CREATE TABLE `spud_admin_permissions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255), `access` tinyint(1), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `scope` varchar(255)) ENGINE=InnoDB
6
-  (20.2ms) CREATE TABLE `spud_user_settings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `key` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
7
-  (9.2ms) CREATE TABLE `spud_users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `first_name` varchar(255), `last_name` varchar(255), `super_admin` tinyint(1), `login` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `crypted_password` varchar(255) NOT NULL, `password_salt` varchar(255) NOT NULL, `persistence_token` varchar(255) NOT NULL, `single_access_token` varchar(255) NOT NULL, `perishable_token` varchar(255) NOT NULL, `login_count` int(11) DEFAULT 0 NOT NULL, `failed_login_count` int(11) DEFAULT 0 NOT NULL, `last_request_at` datetime, `current_login_at` datetime, `last_login_at` datetime, `current_login_ip` varchar(255), `last_login_ip` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `time_zone` varchar(255)) ENGINE=InnoDB
8
-  (13.0ms) CREATE INDEX `index_spud_users_on_email` ON `spud_users` (`email`)
9
-  (11.9ms) CREATE INDEX `index_spud_users_on_login` ON `spud_users` (`login`)
10
-  (10.6ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
11
-  (15.6ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
12
-  (0.1ms) SELECT version FROM `schema_migrations`
13
-  (1.3ms) INSERT INTO `schema_migrations` (version) VALUES ('20120329174000')
14
-  (0.2ms) INSERT INTO `schema_migrations` (version) VALUES ('20111214161011')
15
-  (0.7ms) INSERT INTO `schema_migrations` (version) VALUES ('20111214161146')
16
-  (0.6ms) INSERT INTO `schema_migrations` (version) VALUES ('20120327124229')
17
-  (0.6ms) INSERT INTO `schema_migrations` (version) VALUES ('20120328235431')
27
+  (54.2ms) CREATE TABLE `spud_admin_permissions` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11), `name` varchar(255), `access` tinyint(1), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `scope` varchar(255)) ENGINE=InnoDB
28
+  (177.3ms) CREATE TABLE `spud_user_settings` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `spud_user_id` int(11), `key` varchar(255), `value` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB
29
+  (191.0ms) CREATE TABLE `spud_users` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `first_name` varchar(255), `last_name` varchar(255), `super_admin` tinyint(1), `login` varchar(255) NOT NULL, `email` varchar(255) NOT NULL, `crypted_password` varchar(255) NOT NULL, `password_salt` varchar(255) NOT NULL, `persistence_token` varchar(255) NOT NULL, `single_access_token` varchar(255) NOT NULL, `perishable_token` varchar(255) NOT NULL, `login_count` int(11) DEFAULT 0 NOT NULL, `failed_login_count` int(11) DEFAULT 0 NOT NULL, `last_request_at` datetime, `current_login_at` datetime, `last_login_at` datetime, `current_login_ip` varchar(255), `last_login_ip` varchar(255), `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `time_zone` varchar(255)) ENGINE=InnoDB
30
+  (105.0ms) CREATE INDEX `index_spud_users_on_email` ON `spud_users` (`email`)
31
+  (100.1ms) CREATE INDEX `index_spud_users_on_login` ON `spud_users` (`login`)
32
+  (115.5ms) CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
33
+  (127.3ms) CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
34
+  (0.3ms) SELECT version FROM `schema_migrations`
35
+  (0.6ms) INSERT INTO `schema_migrations` (version) VALUES ('20120329174000')
36
+  (0.4ms) INSERT INTO `schema_migrations` (version) VALUES ('20111214161011')
37
+  (0.4ms) INSERT INTO `schema_migrations` (version) VALUES ('20111214161146')
38
+  (0.4ms) INSERT INTO `schema_migrations` (version) VALUES ('20120327124229')
39
+  (0.3ms) INSERT INTO `schema_migrations` (version) VALUES ('20120328235431')