Permalink
Browse files

добавил авторизацию перед входом в админку

  • Loading branch information...
FladeX committed Jan 7, 2012
1 parent f7e14f5 commit f2c25e53e0c19b7d7eb70672e6104061a6765941
Showing with 5,042 additions and 3 deletions.
  1. +1 −1 apps/backend/config/security.yml
  2. +13 −1 apps/backend/config/settings.yml
  3. +1 −1 apps/backend/lib/myUser.class.php
  4. +2 −0 apps/frontend/config/settings.yml
  5. +1 −0 config/ProjectConfiguration.class.php
  6. +16 −0 data/sql/schema.sql
  7. +95 −0 lib/filter/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardGroupFormFilter.class.php
  8. +95 −0 lib/filter/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardPermissionFormFilter.class.php
  9. +119 −0 lib/filter/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUserFormFilter.class.php
  10. +16 −0 lib/filter/doctrine/sfDoctrineGuardPlugin/sfGuardGroupFormFilter.class.php
  11. +16 −0 lib/filter/doctrine/sfDoctrineGuardPlugin/sfGuardPermissionFormFilter.class.php
  12. +16 −0 lib/filter/doctrine/sfDoctrineGuardPlugin/sfGuardUserFormFilter.class.php
  13. +155 −0 lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardGroupForm.class.php
  14. +155 −0 lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardPermissionForm.class.php
  15. +174 −0 lib/form/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUserForm.class.php
  16. +16 −0 lib/form/doctrine/sfDoctrineGuardPlugin/sfGuardGroupForm.class.php
  17. +16 −0 lib/form/doctrine/sfDoctrineGuardPlugin/sfGuardPermissionForm.class.php
  18. +16 −0 lib/form/doctrine/sfDoctrineGuardPlugin/sfGuardUserForm.class.php
  19. +63 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardForgotPassword.class.php
  20. +74 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardGroup.class.php
  21. +64 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardGroupPermission.class.php
  22. +74 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardPermission.class.php
  23. +62 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardRememberKey.class.php
  24. +156 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUser.class.php
  25. +64 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUserGroup.class.php
  26. +64 −0 lib/model/doctrine/sfDoctrineGuardPlugin/base/BasesfGuardUserPermission.class.php
  27. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardForgotPassword.class.php
  28. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardForgotPasswordTable.class.php
  29. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardGroup.class.php
  30. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardGroupPermission.class.php
  31. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardGroupPermissionTable.class.php
  32. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardGroupTable.class.php
  33. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardPermission.class.php
  34. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardPermissionTable.class.php
  35. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardRememberKey.class.php
  36. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardRememberKeyTable.class.php
  37. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardUser.class.php
  38. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardUserGroup.class.php
  39. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardUserGroupTable.class.php
  40. +15 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardUserPermission.class.php
  41. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardUserPermissionTable.class.php
  42. +19 −0 lib/model/doctrine/sfDoctrineGuardPlugin/sfGuardUserTable.class.php
  43. +1 −0 plugins/.channels/.alias/pear.txt
  44. +1 −0 plugins/.channels/.alias/pecl.txt
  45. +1 −0 plugins/.channels/.alias/phpdocs.txt
  46. +1 −0 plugins/.channels/.alias/symfony-plugins.txt
  47. +1 −0 plugins/.channels/.alias/symfony.txt
  48. +1 −0 plugins/.channels/__uri.reg
  49. +1 −0 plugins/.channels/doc.php.net.reg
  50. +1 −0 plugins/.channels/pear.php.net.reg
  51. +1 −0 plugins/.channels/pear.symfony-project.com.reg
  52. +1 −0 plugins/.channels/pecl.php.net.reg
  53. +1 −0 plugins/.channels/plugins.symfony-project.org.reg
  54. +1 −0 plugins/.depdb
  55. 0 plugins/.depdblock
  56. +1 −0 plugins/.filemap
  57. 0 plugins/.lock
  58. +4 −0 plugins/.registry/.channel.pear.symfony-project.com/symfony.reg
  59. +1 −0 plugins/.registry/.channel.plugins.symfony-project.org/sfdoctrineguardplugin.reg
  60. BIN plugins/sfDoctrineGuardPlugin/.DS_Store
  61. +7 −0 plugins/sfDoctrineGuardPlugin/LICENSE
  62. +305 −0 plugins/sfDoctrineGuardPlugin/README
  63. +1 −0 plugins/sfDoctrineGuardPlugin/VERSION
  64. +182 −0 plugins/sfDoctrineGuardPlugin/config/doctrine/schema.yml
  65. +40 −0 plugins/sfDoctrineGuardPlugin/config/sfDoctrineGuardPluginConfiguration.class.php
  66. +20 −0 plugins/sfDoctrineGuardPlugin/data/fixtures/fixtures.yml.sample
  67. 0 plugins/sfDoctrineGuardPlugin/data/tasks/.sf
  68. +33 −0 plugins/sfDoctrineGuardPlugin/i18n/sf_guard.es.xml
  69. +33 −0 plugins/sfDoctrineGuardPlugin/i18n/sf_guard.fr.xml
  70. +13 −0 plugins/sfDoctrineGuardPlugin/lib/filter/doctrine/PluginsfGuardGroupFormFilter.class.php
  71. +13 −0 plugins/sfDoctrineGuardPlugin/lib/filter/doctrine/PluginsfGuardPermissionFormFilter.class.php
  72. +13 −0 plugins/sfDoctrineGuardPlugin/lib/filter/doctrine/PluginsfGuardUserFormFilter.class.php
  73. +42 −0 plugins/sfDoctrineGuardPlugin/lib/form/base/BasesfGuardRequestForgotPasswordForm.class.php
  74. +28 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/PluginsfGuardGroupForm.class.php
  75. +25 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/PluginsfGuardPermissionForm.class.php
  76. +13 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/PluginsfGuardUserForm.class.php
  77. +27 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/base/BasesfGuardChangeUserPasswordForm.class.php
  78. +40 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/base/BasesfGuardFormSignin.class.php
  79. +27 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/base/BasesfGuardRegisterForm.class.php
  80. +40 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/base/BasesfGuardUserAdminForm.class.php
  81. +19 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/sfGuardChangeUserPasswordForm.class.php
  82. +19 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/sfGuardFormSignin.class.php
  83. +19 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/sfGuardRegisterForm.class.php
  84. +19 −0 plugins/sfDoctrineGuardPlugin/lib/form/doctrine/sfGuardUserAdminForm.class.php
  85. +19 −0 plugins/sfDoctrineGuardPlugin/lib/form/sfGuardRequestForgotPasswordForm.class.php
  86. +16 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardForgotPassword.class.php
  87. +7 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardForgotPasswordTable.class.php
  88. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardGroup.class.php
  89. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardGroupPermission.class.php
  90. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardGroupPermissionTable.class.php
  91. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardGroupTable.class.php
  92. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardPermission.class.php
  93. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardPermissionTable.class.php
  94. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardRememberKey.class.php
  95. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardRememberKeyTable.class.php
  96. +292 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUser.class.php
  97. +18 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUserGroup.class.php
  98. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUserGroupTable.class.php
  99. +18 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUserPermission.class.php
  100. +13 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUserPermissionTable.class.php
  101. +48 −0 plugins/sfDoctrineGuardPlugin/lib/model/doctrine/PluginsfGuardUserTable.class.php
  102. +118 −0 plugins/sfDoctrineGuardPlugin/lib/routing/sfGuardRouting.class.php
  103. +56 −0 plugins/sfDoctrineGuardPlugin/lib/sfGuardBasicSecurityFilter.class.php
  104. +58 −0 plugins/sfDoctrineGuardPlugin/lib/sfGuardRememberMeFilter.class.php
  105. +66 −0 plugins/sfDoctrineGuardPlugin/lib/task/sfGuardAddGroupTask.class.php
  106. +66 −0 plugins/sfDoctrineGuardPlugin/lib/task/sfGuardAddPermissionTask.class.php
  107. +70 −0 plugins/sfDoctrineGuardPlugin/lib/task/sfGuardChangePasswordTask.class.php
  108. +71 −0 plugins/sfDoctrineGuardPlugin/lib/task/sfGuardCreateUserTask.class.php
  109. +70 −0 plugins/sfDoctrineGuardPlugin/lib/task/sfGuardPromoteSuperAdminTask.class.php
  110. +391 −0 plugins/sfDoctrineGuardPlugin/lib/user/sfGuardSecurityUser.class.php
  111. +69 −0 plugins/sfDoctrineGuardPlugin/lib/validator/sfGuardValidatorUser.class.php
  112. +22 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/actions/actions.class.php
  113. +22 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/actions/components.class.php
  114. +8 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/config/security.yml
  115. +89 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/lib/BasesfGuardAuthActions.class.php
  116. +10 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/lib/BasesfGuardAuthComponents.class.php
  117. +25 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/templates/_signin_form.php
  118. +9 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/templates/secureSuccess.php
  119. +5 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardAuth/templates/signinSuccess.php
  120. +15 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardForgotPassword/actions/actions.class.php
  121. +95 −0 ...fDoctrineGuardPlugin/modules/sfGuardForgotPassword/lib/BasesfGuardForgotPasswordActions.class.php
  122. +7 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardForgotPassword/templates/_new_password.php
  123. +8 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardForgotPassword/templates/_send_request.php
  124. +13 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardForgotPassword/templates/changeSuccess.php
  125. +16 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardForgotPassword/templates/indexSuccess.php
  126. +16 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardGroup/actions/actions.class.php
  127. +25 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardGroup/config/generator.yml
  128. +13 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardGroup/lib/sfGuardGroupGeneratorConfiguration.class.php
  129. +13 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardGroup/lib/sfGuardGroupGeneratorHelper.class.php
  130. +16 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardPermission/actions/actions.class.php
  131. +25 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardPermission/config/generator.yml
  132. +13 −0 ...ctrineGuardPlugin/modules/sfGuardPermission/lib/sfGuardPermissionGeneratorConfiguration.class.php
  133. +13 −0 ...ns/sfDoctrineGuardPlugin/modules/sfGuardPermission/lib/sfGuardPermissionGeneratorHelper.class.php
  134. +15 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardRegister/actions/actions.class.php
  135. +7 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardRegister/actions/components.class.php
  136. +27 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardRegister/lib/BasesfGuardRegisterActions.class.php
  137. +9 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardRegister/lib/BasesfGuardRegisterComponents.class.php
  138. +14 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardRegister/templates/_form.php
  139. +4 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardRegister/templates/indexSuccess.php
  140. +16 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardUser/actions/actions.class.php
  141. +31 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardUser/config/generator.yml
  142. +20 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardUser/lib/BasesfGuardUserActions.class.php
  143. +13 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardUser/lib/sfGuardUserGeneratorConfiguration.class.php
  144. +13 −0 plugins/sfDoctrineGuardPlugin/modules/sfGuardUser/lib/sfGuardUserGeneratorHelper.class.php
  145. BIN plugins/sfDoctrineGuardPlugin/sfDoctrineGuardPlugin-5.0.0.tgz
@@ -2,4 +2,4 @@
# http://www.symfony-project.org/reference/1_4/en/08-Security
default:
- is_secure: false
+ is_secure: true
@@ -23,7 +23,19 @@ test:
etag: false
all:
+ .actions:
+ default_module: projects
+ default_action: index
+
+ login_module: sfGuardAuth
+ login_action: signin
+
+ secure_module: sfGuardAuth
+ secure_action: secure
+
.settings:
+ enabled_modules: [default, sfGuardGroup, sfGuardUser, sfGuardPermission, sfGuardAuth]
+
# Form security secret (CSRF protection)
csrf_secret: 26193c53dc5e0b09e8c7fbe6a9d12c64ec5f7c22
@@ -32,4 +44,4 @@ all:
escaping_method: ESC_SPECIALCHARS
# Enable the database manager
- use_database: true
+ use_database: true
@@ -1,5 +1,5 @@
<?php
-class myUser extends sfBasicSecurityUser
+class myUser extends sfGuardSecurityUser
{
}
@@ -24,6 +24,8 @@ test:
all:
.settings:
+ enabled_modules: [default, sfGuardAuth]
+
# Form security secret (CSRF protection)
csrf_secret: 4dad8f1db6467357fb6d14016642707597ac213a
@@ -8,5 +8,6 @@ class ProjectConfiguration extends sfProjectConfiguration
public function setup()
{
$this->enablePlugins('sfDoctrinePlugin');
+ $this->enablePlugins('sfDoctrineGuardPlugin');
}
}
View
@@ -6,6 +6,14 @@ CREATE TABLE projects (id BIGINT AUTO_INCREMENT, author_id BIGINT NOT NULL, titl
CREATE TABLE reports (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, project_id BIGINT NOT NULL, posting_name VARCHAR(255) NOT NULL, posting_password VARCHAR(255) NOT NULL, posting_messages BIGINT NOT NULL, posting_date DATETIME NOT NULL, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX project_id_idx (project_id), INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE reviews (id BIGINT AUTO_INCREMENT, author_id BIGINT NOT NULL, recepient_id BIGINT NOT NULL, text TEXT NOT NULL, type TINYINT(1) DEFAULT '1' NOT NULL, status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX recepient_id_idx (recepient_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE search_history (id BIGINT AUTO_INCREMENT, query VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_forgot_password (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, unique_key VARCHAR(255), expires_at DATETIME NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_group (id BIGINT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_group_permission (group_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(group_id, permission_id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_permission (id BIGINT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_remember_key (id BIGINT AUTO_INCREMENT, user_id BIGINT, remember_key VARCHAR(32), ip_address VARCHAR(50), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_user (id BIGINT AUTO_INCREMENT, first_name VARCHAR(255), last_name VARCHAR(255), email_address VARCHAR(255) NOT NULL UNIQUE, username VARCHAR(128) NOT NULL UNIQUE, algorithm VARCHAR(128) DEFAULT 'sha1' NOT NULL, salt VARCHAR(128), password VARCHAR(128), is_active TINYINT(1) DEFAULT '1', is_super_admin TINYINT(1) DEFAULT '0', last_login DATETIME, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_active_idx_idx (is_active), PRIMARY KEY(id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_user_group (user_id BIGINT, group_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, group_id)) ENGINE = INNODB;
+CREATE TABLE sf_guard_user_permission (user_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, permission_id)) ENGINE = INNODB;
CREATE TABLE users (id BIGINT AUTO_INCREMENT, user_name VARCHAR(255) NOT NULL, user_email VARCHAR(255) NOT NULL, user_status BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
ALTER TABLE badges ADD CONSTRAINT badges_user_id_users_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE bids ADD CONSTRAINT bids_user_id_users_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -16,3 +24,11 @@ ALTER TABLE projects ADD CONSTRAINT projects_author_id_users_id FOREIGN KEY (aut
ALTER TABLE reports ADD CONSTRAINT reports_user_id_users_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE reports ADD CONSTRAINT reports_project_id_projects_id FOREIGN KEY (project_id) REFERENCES projects(id) ON DELETE CASCADE;
ALTER TABLE reviews ADD CONSTRAINT reviews_recepient_id_users_id FOREIGN KEY (recepient_id) REFERENCES users(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_forgot_password ADD CONSTRAINT sf_guard_forgot_password_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_remember_key ADD CONSTRAINT sf_guard_remember_key_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
+ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * sfGuardGroup filter form base class.
+ *
+ * @package posting
+ * @subpackage filter
+ * @author Your name here
+ * @version SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
+ */
+abstract class BasesfGuardGroupFormFilter extends BaseFormFilterDoctrine
+{
+ public function setup()
+ {
+ $this->setWidgets(array(
+ 'name' => new sfWidgetFormFilterInput(),
+ 'description' => new sfWidgetFormFilterInput(),
+ 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
+ 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
+ 'users_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardUser')),
+ 'permissions_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission')),
+ ));
+
+ $this->setValidators(array(
+ 'name' => new sfValidatorPass(array('required' => false)),
+ 'description' => new sfValidatorPass(array('required' => false)),
+ 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
+ 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
+ 'users_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardUser', 'required' => false)),
+ 'permissions_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission', 'required' => false)),
+ ));
+
+ $this->widgetSchema->setNameFormat('sf_guard_group_filters[%s]');
+
+ $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
+
+ $this->setupInheritance();
+
+ parent::setup();
+ }
+
+ public function addUsersListColumnQuery(Doctrine_Query $query, $field, $values)
+ {
+ if (!is_array($values))
+ {
+ $values = array($values);
+ }
+
+ if (!count($values))
+ {
+ return;
+ }
+
+ $query
+ ->leftJoin($query->getRootAlias().'.sfGuardUserGroup sfGuardUserGroup')
+ ->andWhereIn('sfGuardUserGroup.user_id', $values)
+ ;
+ }
+
+ public function addPermissionsListColumnQuery(Doctrine_Query $query, $field, $values)
+ {
+ if (!is_array($values))
+ {
+ $values = array($values);
+ }
+
+ if (!count($values))
+ {
+ return;
+ }
+
+ $query
+ ->leftJoin($query->getRootAlias().'.sfGuardGroupPermission sfGuardGroupPermission')
+ ->andWhereIn('sfGuardGroupPermission.permission_id', $values)
+ ;
+ }
+
+ public function getModelName()
+ {
+ return 'sfGuardGroup';
+ }
+
+ public function getFields()
+ {
+ return array(
+ 'id' => 'Number',
+ 'name' => 'Text',
+ 'description' => 'Text',
+ 'created_at' => 'Date',
+ 'updated_at' => 'Date',
+ 'users_list' => 'ManyKey',
+ 'permissions_list' => 'ManyKey',
+ );
+ }
+}
@@ -0,0 +1,95 @@
+<?php
+
+/**
+ * sfGuardPermission filter form base class.
+ *
+ * @package posting
+ * @subpackage filter
+ * @author Your name here
+ * @version SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
+ */
+abstract class BasesfGuardPermissionFormFilter extends BaseFormFilterDoctrine
+{
+ public function setup()
+ {
+ $this->setWidgets(array(
+ 'name' => new sfWidgetFormFilterInput(),
+ 'description' => new sfWidgetFormFilterInput(),
+ 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
+ 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
+ 'groups_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup')),
+ 'users_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardUser')),
+ ));
+
+ $this->setValidators(array(
+ 'name' => new sfValidatorPass(array('required' => false)),
+ 'description' => new sfValidatorPass(array('required' => false)),
+ 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
+ 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
+ 'groups_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup', 'required' => false)),
+ 'users_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardUser', 'required' => false)),
+ ));
+
+ $this->widgetSchema->setNameFormat('sf_guard_permission_filters[%s]');
+
+ $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
+
+ $this->setupInheritance();
+
+ parent::setup();
+ }
+
+ public function addGroupsListColumnQuery(Doctrine_Query $query, $field, $values)
+ {
+ if (!is_array($values))
+ {
+ $values = array($values);
+ }
+
+ if (!count($values))
+ {
+ return;
+ }
+
+ $query
+ ->leftJoin($query->getRootAlias().'.sfGuardGroupPermission sfGuardGroupPermission')
+ ->andWhereIn('sfGuardGroupPermission.group_id', $values)
+ ;
+ }
+
+ public function addUsersListColumnQuery(Doctrine_Query $query, $field, $values)
+ {
+ if (!is_array($values))
+ {
+ $values = array($values);
+ }
+
+ if (!count($values))
+ {
+ return;
+ }
+
+ $query
+ ->leftJoin($query->getRootAlias().'.sfGuardUserPermission sfGuardUserPermission')
+ ->andWhereIn('sfGuardUserPermission.user_id', $values)
+ ;
+ }
+
+ public function getModelName()
+ {
+ return 'sfGuardPermission';
+ }
+
+ public function getFields()
+ {
+ return array(
+ 'id' => 'Number',
+ 'name' => 'Text',
+ 'description' => 'Text',
+ 'created_at' => 'Date',
+ 'updated_at' => 'Date',
+ 'groups_list' => 'ManyKey',
+ 'users_list' => 'ManyKey',
+ );
+ }
+}
@@ -0,0 +1,119 @@
+<?php
+
+/**
+ * sfGuardUser filter form base class.
+ *
+ * @package posting
+ * @subpackage filter
+ * @author Your name here
+ * @version SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
+ */
+abstract class BasesfGuardUserFormFilter extends BaseFormFilterDoctrine
+{
+ public function setup()
+ {
+ $this->setWidgets(array(
+ 'first_name' => new sfWidgetFormFilterInput(),
+ 'last_name' => new sfWidgetFormFilterInput(),
+ 'email_address' => new sfWidgetFormFilterInput(array('with_empty' => false)),
+ 'username' => new sfWidgetFormFilterInput(array('with_empty' => false)),
+ 'algorithm' => new sfWidgetFormFilterInput(array('with_empty' => false)),
+ 'salt' => new sfWidgetFormFilterInput(),
+ 'password' => new sfWidgetFormFilterInput(),
+ 'is_active' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
+ 'is_super_admin' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
+ 'last_login' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
+ 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
+ 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
+ 'groups_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup')),
+ 'permissions_list' => new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission')),
+ ));
+
+ $this->setValidators(array(
+ 'first_name' => new sfValidatorPass(array('required' => false)),
+ 'last_name' => new sfValidatorPass(array('required' => false)),
+ 'email_address' => new sfValidatorPass(array('required' => false)),
+ 'username' => new sfValidatorPass(array('required' => false)),
+ 'algorithm' => new sfValidatorPass(array('required' => false)),
+ 'salt' => new sfValidatorPass(array('required' => false)),
+ 'password' => new sfValidatorPass(array('required' => false)),
+ 'is_active' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
+ 'is_super_admin' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
+ 'last_login' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
+ 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
+ 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
+ 'groups_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardGroup', 'required' => false)),
+ 'permissions_list' => new sfValidatorDoctrineChoice(array('multiple' => true, 'model' => 'sfGuardPermission', 'required' => false)),
+ ));
+
+ $this->widgetSchema->setNameFormat('sf_guard_user_filters[%s]');
+
+ $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
+
+ $this->setupInheritance();
+
+ parent::setup();
+ }
+
+ public function addGroupsListColumnQuery(Doctrine_Query $query, $field, $values)
+ {
+ if (!is_array($values))
+ {
+ $values = array($values);
+ }
+
+ if (!count($values))
+ {
+ return;
+ }
+
+ $query
+ ->leftJoin($query->getRootAlias().'.sfGuardUserGroup sfGuardUserGroup')
+ ->andWhereIn('sfGuardUserGroup.group_id', $values)
+ ;
+ }
+
+ public function addPermissionsListColumnQuery(Doctrine_Query $query, $field, $values)
+ {
+ if (!is_array($values))
+ {
+ $values = array($values);
+ }
+
+ if (!count($values))
+ {
+ return;
+ }
+
+ $query
+ ->leftJoin($query->getRootAlias().'.sfGuardUserPermission sfGuardUserPermission')
+ ->andWhereIn('sfGuardUserPermission.permission_id', $values)
+ ;
+ }
+
+ public function getModelName()
+ {
+ return 'sfGuardUser';
+ }
+
+ public function getFields()
+ {
+ return array(
+ 'id' => 'Number',
+ 'first_name' => 'Text',
+ 'last_name' => 'Text',
+ 'email_address' => 'Text',
+ 'username' => 'Text',
+ 'algorithm' => 'Text',
+ 'salt' => 'Text',
+ 'password' => 'Text',
+ 'is_active' => 'Boolean',
+ 'is_super_admin' => 'Boolean',
+ 'last_login' => 'Date',
+ 'created_at' => 'Date',
+ 'updated_at' => 'Date',
+ 'groups_list' => 'ManyKey',
+ 'permissions_list' => 'ManyKey',
+ );
+ }
+}
Oops, something went wrong.

0 comments on commit f2c25e5

Please sign in to comment.