Author: allyb
Date: 2010-01-14 13:25:05 +0100 (Thu, 14 Jan 2010)
New Revision: 26619
Removed:
plugins/sfEasyAuthPlugin/trunk/config/schema.yml.dynamic
Modified:
plugins/sfEasyAuthPlugin/trunk/README
plugins/sfEasyAuthPlugin/trunk/config/app.yml
plugins/sfEasyAuthPlugin/trunk/config/schema.yml
Log:
Bundled sfEasyAuthPlugin for release
Modified: plugins/sfEasyAuthPlugin/trunk/README
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/README 2010-01-14 12:15:10 UTC (rev
26618)
+++ plugins/sfEasyAuthPlugin/trunk/README 2010-01-14 12:25:05 UTC (rev
26619)
@@ -15,6 +15,11 @@
This plugin supports users having multiple credentials, brute force protection
(with
configurable attempt and lock-out thresholds), user profiles and a remember me
feature.
+Versions
+--------
+
+This plugin is currently being ported to Doctrine and Symfony 1.4. It is
called sfEasyAuthDoctrinePlugin.
+
Installation
------------
@@ -22,8 +27,30 @@
$ symfony plugin:install sfEasyAuthPlugin
+ * Edit the config/schema.yml file and add extra key/value pairs under
sfEasyAuthUser's 'type' 'inheritance'
+ field to define the types of user/role to create:
+
+ [yml]
+ sf_easy_auth_user:
+ type:
+ inheritance:
+ admin: sfEasyAuthAdmin
+ member: sfEasyAuthMember
+
+ For more information on this, see the `Adding more user types` section.
+
+ * Edit the `sf_easy_auth_remember_salt` setting in the app.yml file - or
better, override it
+ your project's app.yml file.
+
+ * Rebuild your model
+
+ $ symfony propel:build-model
+ $ symfony propel:build-sql
+ $ symfony propel:build-forms
+ $ symfony propel:build-filters
+
* Create some new classes in your project's lib/model directory:
-
+
class sfEasyAuthUser extends sfEasyAuthUserBase
{}
class sfEasyAuthUserPeer extends sfEasyAuthUserBasePeer
@@ -31,16 +58,9 @@
// create as many of the following classes as you have different user
types.
class sfEasyAuthAdminLocal extends sfEasyAuthUser
{}
- class sfEasyAuthBasicUserLocal extends sfEasyAuthUser
+ class sfEasyAuthMemberLocal extends sfEasyAuthUser
{}
-
- * Rebuild your model
- $ symfony propel:build-model
- $ symfony propel:build-sql
- $ symfony propel:build-forms
- $ symfony propel:build-filters
-
* Update your database tables by starting from scratch (it will delete all
the existing tables, then re-create them):
@@ -77,12 +97,12 @@
class: sfEasyAuthAutoLoginFilter
* Edit each of the generated class files in
plugins/sfEasyAuthPlugin/lib/model that
- represent your user types (e.g. sfEasyAuthAdmin.php and
sfEasyAuthBasicUser.php) and
+ represent your user types (e.g. sfEasyAuthAdmin.php and
sfEasyAuthMember.php) and
make them extend your manually created 'local' classes, e.g.
[php]
class sfEasyAuthAdmin extends sfEasyAuthAdminLocal
- class sfEasyAuthBasicUser extends sfEasyAuthBasicUserLocal
+ class sfEasyAuthMember extends sfEasyAuthMemberLocal
* Clear your cache
@@ -90,7 +110,7 @@
* Optionally create a default user (the user type is case sensitive):
- $ symfony easyAuth:create-user al 5ecret1 [email protected] basicUser
+ $ symfony easyAuth:create-user al 5ecret1 [email protected] member
* Optionally create a default admin user:
@@ -298,6 +318,9 @@
Send password reset and account activation emails with your own mailer class
----------------------------------------------------------------------------
+NOTE: This behaviour of this feature will change when the plugin is released
for
+ symfony 1.3/1.4.
+
sfEasyAuth gives you the flexibility to send emails to users however you want.
By default it uses the sfEasyAuthSimpleMailer class which uses the PHP `mail`
method for
sending emails. This function is simple, but doesn't support more advanced
features like
@@ -382,7 +405,7 @@
[yml]
schema_inheritance: # Credential inheritance definition
for the plugin.
- admin: sfEasyAuthAdmin # These values will be inserted into
the schema.
- - basicUser: sfEasyAuthBasicUser # Keys are credential names, values
are authentication
+ - member: sfEasyAuthMember # Keys are credential names, values are
authentication
- editor: sfEasyAuthEditor # classes.
Any users that are created as editors will automatically acquire the `editor`
credential
@@ -396,12 +419,12 @@
[plain]
super class: sfEasyAuthUser
class sfEasyAuthAdmin extends sfEasyAuthUser # has credential
`admin`
- class sfEasyAuthBasicUser extends sfEasyAuthUser # has credential
`basicUser`
- class sfEasyAuthTrustedUser extends sfEasyAuthBasicUser # has
credentials `trustedUser`
- # and `basicUser`
+ class sfEasyAuthMember extends sfEasyAuthUser # has credential
`member`
+ class sfEasyAuthTrustedUser extends sfEasyAuthMember # has
credentials `trustedUser`
+ # and `member`
This approach allows you to define the action associated with a credential in
the model
-instead of with groups and permissions in the database. For example
`basicUsers` may be
+instead of with groups and permissions in the database. For example `members`
may be
able to post blog comments, and `trustedUsers` may be able to edit them.
Simply setting
the credentials required in your `security.yml` file on the appropriate
actions would then
apply the restrictions, saving potentially costly database queries.
@@ -458,9 +481,9 @@
sfEasyAuthUser
|
--------------------------------------------- ...
- sfEasyAuthAdminLocal sfEasyAuthBasicUserLocal
+ sfEasyAuthAdminLocal sfEasyAuthMemberLocal
| |
- sfEasyAuthAdmin* sfEasyAuthBasicUser*
+ sfEasyAuthAdmin* sfEasyAuthMember*
In the above diagram, classes with an asterisk (*) next to their names are in
the plugin/sfEasyAuth/lib
directory. You need to create the other classes manually as mentioned in the
`Installation` section.
@@ -499,7 +522,7 @@
[php]
// if the user is not logged in or doesn't have the right credential
- if (!($this->getUser()->isAuthenticated() &&
$this->getUser()->hasCredential('basicUser')))
+ if (!($this->getUser()->isAuthenticated() &&
$this->getUser()->hasCredential('member')))
{
// save the url of the page the user was trying to visit
$this->getUser()->setAttribute('sf_easy_auth.restricted_url',
$request->getUri());
Modified: plugins/sfEasyAuthPlugin/trunk/config/app.yml
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/config/app.yml 2010-01-14 12:15:10 UTC
(rev 26618)
+++ plugins/sfEasyAuthPlugin/trunk/config/app.yml 2010-01-14 12:25:05 UTC
(rev 26619)
@@ -1,14 +1,10 @@
all:
sf_easy_auth:
- schema_inheritance: # Credential inheritance definition
for the plugin.
- - admin: sfEasyAuthAdmin # These values will be inserted into
the schema.
- - basicUser: sfEasyAuthBasicUser # Keys are credential names, values
are authentication classes.
- # DO NOT CREATE A CLASS CALLED
'sfEasyAuthUser'
-
- profile_prefix: Sb # Prefix for profile classes. Tables
used for profile
+ profile_prefix: '' # Optional prefix for profile
classes. Tables used for profile
# data will be formed by prepending
this prefix to
# schema_inheritance keys, with the
first character
- # converted to uppercase, e.g.
SbBasicUser
+ # converted to uppercase, e.g.
MyMember. This prefix allows
+ # for a kind of poor-man's namespace
to be defined.
password_reset_mailer_callable: sfEasyAuthSimpleMailer::mail
# callable to send password reset emails. It must be a static method.
It
Modified: plugins/sfEasyAuthPlugin/trunk/config/schema.yml
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/config/schema.yml 2010-01-14 12:15:10 UTC
(rev 26618)
+++ plugins/sfEasyAuthPlugin/trunk/config/schema.yml 2010-01-14 12:25:05 UTC
(rev 26619)
@@ -26,9 +26,7 @@
index: true
inheritance:
admin: sfEasyAuthAdmin
- superAdmin: sfEasyAuthSuperAdmin
- student: sfEasyAuthStudent
- company: sfEasyAuthCompany
+ member: sfEasyAuthMember # do NOT create a
class called 'user' or sfEasyAuthUser
profile_id: { type: integer, default: 0, index: true }
sf_easy_auth_user_credential:
Deleted: plugins/sfEasyAuthPlugin/trunk/config/schema.yml.dynamic
===================================================================
--- plugins/sfEasyAuthPlugin/trunk/config/schema.yml.dynamic 2010-01-14
12:15:10 UTC (rev 26618)
+++ plugins/sfEasyAuthPlugin/trunk/config/schema.yml.dynamic 2010-01-14
12:25:05 UTC (rev 26619)
@@ -1,47 +0,0 @@
-propel:
- _attributes: { package: plugins.sfEasyAuthPlugin.lib.model }
-
- sf_easy_auth_user:
- _attributes: { phpName: sfEasyAuthUserBase }
- id: ~
- username: { type: varchar(50), required: true, index: unique }
- password: { type: varchar(32), required: true }
- email: { type: varchar(255), required: true, index: unique }
- email_confirmed: { type: boolean, default: 0 }
- salt: { type: varchar(32), required: true }
- created_at: ~
- updated_at: ~
- last_login: { type: timestamp }
- last_login_attempt: { type: timestamp }
- failed_logins: { type: integer, default: 0 }
- locked_by_admins: { type: boolean, default: 0 }
- remember_key: { type: varchar(42), index: true }
- remember_key_lifetime: { type: timestamp }
- auto_login_hash: { type: varchar(32) }
- password_reset_token: { type: varchar(12) }
- password_reset_token_created_at: { type: timestamp }
- has_extra_credentials: { type: boolean, default: 0 }
- type:
- type: varchar(10)
- index: true
- inheritance:
- <?php
- $data = sfConfig::get('app_sf_easy_auth_schema_inheritance');
- for($i=0; $i<count($data); $i++)
- {
- echo $data[$i];
- echo ($i+1 < count($data)) ? "\n " : "\n";
- } ?>
- profile_id: { type: integer, default: 0, index: true }
-
- sf_easy_auth_user_credential:
- _attributes: { phpName: sfEasyAuthUserCredential }
- id: ~
- user_id:
- type: integer
- foreignTable: sf_easy_auth_user
- foreignReference: id
- required: true
- index: true
- credential: { type: varchar(60), required: true }
- profile_id: { type: integer, default: 0, index: unique }
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.