Changeset 12896
- Timestamp:
- 11/10/08 20:02:34 (5 years ago)
- Files:
-
- plugins/sfGuardPlugin/branches/1.2/config/config.php (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/lib/filter (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base/BasesfGuardGroupFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base/BasesfGuardGroupPermissionFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base/BasesfGuardPermissionFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base/BasesfGuardRememberKeyFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base/BasesfGuardUserFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base/BasesfGuardUserGroupFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/base/BasesfGuardUserPermissionFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/sfGuardGroupFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/sfGuardGroupPermissionFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/sfGuardPermissionFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/sfGuardRememberKeyFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/sfGuardUserFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/sfGuardUserGroupFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/filter/sfGuardUserPermissionFormFilter.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/form/sfGuardGroupForm.class.php (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/lib/form/sfGuardPermissionForm.class.php (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/lib/form/sfGuardUserAdminForm.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/lib/form/sfGuardUserForm.class.php (modified) (2 diffs)
- plugins/sfGuardPlugin/branches/1.2/lib/sfGuardRouting.class.php (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/actions/actions.class.php (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/config/generator.yml (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/lib (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/lib/sfGuardGroupGeneratorConfiguration.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/lib/sfGuardGroupGeneratorHelper.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/templates (deleted)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/validate (deleted)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/actions/actions.class.php (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/config/generator.yml (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/lib (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/lib/sfGuardPermissionGeneratorConfiguration.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/lib/sfGuardPermissionGeneratorHelper.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/templates (deleted)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/validate (deleted)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/actions/actions.class.php (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/config/generator.yml (modified) (1 diff)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/lib/BasesfGuardUserActions.class.php (deleted)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/lib/sfGuardUserGeneratorConfiguration.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/lib/sfGuardUserGeneratorHelper.class.php (added)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/templates (deleted)
- plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/validate (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfGuardPlugin/branches/1.2/config/config.php
r7636 r12896 5 5 $this->dispatcher->connect('routing.load_configuration', array('sfGuardRouting', 'listenToRoutingLoadConfigurationEvent')); 6 6 } 7 8 foreach (array('sfGuardUser', 'sfGuardGroup', 'sfGuardPermission') as $module) 9 { 10 if (in_array($module, sfConfig::get('sf_enabled_modules'))) 11 { 12 $this->dispatcher->connect('routing.load_configuration', array('sfGuardRouting', 'addRouteForAdmin'.str_replace('sfGuard', '', $module))); 13 } 14 } plugins/sfGuardPlugin/branches/1.2/lib/form/sfGuardGroupForm.class.php
r7745 r12896 12 12 public function configure() 13 13 { 14 unset($this['sf_guard_user_group_list']); 15 16 $this->widgetSchema['sf_guard_group_permission_list']->setLabel('Permissions'); 14 17 } 15 18 } plugins/sfGuardPlugin/branches/1.2/lib/form/sfGuardPermissionForm.class.php
r7745 r12896 12 12 public function configure() 13 13 { 14 unset($this['sf_guard_user_permission_list']); 15 16 $this->widgetSchema['sf_guard_group_permission_list']->setLabel('Groups'); 14 17 } 15 18 } plugins/sfGuardPlugin/branches/1.2/lib/form/sfGuardUserForm.class.php
r12075 r12896 8 8 * @version SVN: $Id$ 9 9 */ 10 class sfGuardUserForm extends BasesfGuardUser Form10 class sfGuardUserForm extends BasesfGuardUserAdminForm 11 11 { 12 12 protected … … 25 25 $this['sf_guard_user_permission_list'] 26 26 ); 27 28 $this->widgetSchema['password'] = new sfWidgetFormInputPassword();29 $this->validatorSchema['password']->setOption('required', false);30 $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();31 $this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];32 33 $this->widgetSchema->moveField('password_again', 'after', 'password');34 35 $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));36 37 // profile form?38 $profileFormClass = sfConfig::get('app_sf_guard_plugin_profile_class', 'sfGuardUserProfile').'Form';39 if (class_exists($profileFormClass))40 {41 $profileForm = new $profileFormClass();42 unset($profileForm[$this->getPrimaryKey()]);43 unset($profileForm[sfConfig::get('app_sf_guard_plugin_profile_field_name', 'user_id')]);44 45 $this->mergeForm($profileForm);46 }47 }48 49 public function updateObject()50 {51 parent::updateObject();52 53 // update defaults for profile54 if (!is_null($profile = $this->getProfile()))55 {56 $values = $this->getValues();57 unset($values[$this->getPrimaryKey()]);58 59 $profile->fromArray($values, BasePeer::TYPE_FIELDNAME);60 $profile->save();61 }62 63 return $this->object;64 }65 66 public function updateDefaultsFromObject()67 {68 parent::updateDefaultsFromObject();69 70 // update defaults for profile71 if (!is_null($profile = $this->getProfile()))72 {73 $values = $profile->toArray(BasePeer::TYPE_FIELDNAME);74 unset($values[$this->getPrimaryKey()]);75 76 // update defaults for the main object77 if ($this->isNew)78 {79 $this->setDefaults(array_merge($values, $this->getDefaults()));80 }81 else82 {83 $this->setDefaults(array_merge($this->getDefaults(), $values));84 }85 }86 }87 88 protected function getProfile()89 {90 try91 {92 return $this->object->getProfile();93 }94 catch (sfException $e)95 {96 // no profile97 return null;98 }99 }100 101 protected function getPrimaryKey()102 {103 if (!is_null($this->pkName))104 {105 return $this->pkName;106 }107 108 $profileClass = sfConfig::get('app_sf_guard_plugin_profile_class', 'sfGuardUserProfile');109 if (class_exists($profileClass))110 {111 $tableMap = call_user_func(array($profileClass.'Peer', 'getTableMap'));112 foreach ($tableMap->getColumns() as $column)113 {114 if ($column->isPrimaryKey())115 {116 return $this->pkName = call_user_func(array($profileClass.'Peer', 'translateFieldname'), $column->getPhpName(), BasePeer::TYPE_PHPNAME, BasePeer::TYPE_FIELDNAME);117 }118 }119 }120 27 } 121 28 } plugins/sfGuardPlugin/branches/1.2/lib/sfGuardRouting.class.php
r12071 r12896 32 32 $r->prependRoute('sf_guard_password', new sfRoute('/request_password', array('module' => 'sfGuardAuth', 'action' => 'password'))); 33 33 } 34 35 static public function addRouteForAdminUser(sfEvent $event) 36 { 37 $event->getSubject()->prependRoute('sf_guard_user', new sfPropelRouteCollection(array( 38 'name' => 'sf_guard_user', 39 'model' => 'sfGuardUser', 40 'module' => 'sfGuardUser', 41 'prefix_path' => 'sf_guard_user', 42 'with_wilcard_routes' => true, 43 'requirements' => array(), 44 ))); 45 } 46 47 static public function addRouteForAdminGroup(sfEvent $event) 48 { 49 $event->getSubject()->prependRoute('sf_guard_group', new sfPropelRouteCollection(array( 50 'name' => 'sf_guard_group', 51 'model' => 'sfGuardGroup', 52 'module' => 'sfGuardGroup', 53 'prefix_path' => 'sf_guard_group', 54 'with_wilcard_routes' => true, 55 'requirements' => array(), 56 ))); 57 } 58 59 static public function addRouteForAdminPermission(sfEvent $event) 60 { 61 $event->getSubject()->prependRoute('sf_guard_permission', new sfPropelRouteCollection(array( 62 'name' => 'sf_guard_permission', 63 'model' => 'sfGuardPermission', 64 'module' => 'sfGuardPermission', 65 'prefix_path' => 'sf_guard_permission', 66 'with_wilcard_routes' => true, 67 'requirements' => array(), 68 ))); 69 } 34 70 } plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/actions/actions.class.php
r7634 r12896 1 1 <?php 2 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 3 require_once dirname(__FILE__).'/../lib/sfGuardGroupGeneratorConfiguration.class.php'; 4 require_once dirname(__FILE__).'/../lib/sfGuardGroupGeneratorHelper.class.php'; 10 5 11 6 /** 12 * Group management.7 * sfGuardGroup actions. 13 8 * 14 * @package s ymfony15 * @subpackage plugin16 * @author Fabien Potencier <fabien.potencier@symfony-project.com>9 * @package sfGuardPlugin 10 * @subpackage sfGuardGroup 11 * @author Fabien Potencier 17 12 * @version SVN: $Id$ 18 13 */ plugins/sfGuardPlugin/branches/1.2/modules/sfGuardGroup/config/generator.yml
r7634 r12896 1 1 generator: 2 class: sfPropelAdminGenerator2 class: sfPropelGenerator 3 3 param: 4 model_class: sfGuardGroup 5 theme: default 4 model_class: sfGuardGroup 5 theme: admin 6 non_verbose_templates: true 7 with_show: false 8 singular: ~ 9 plural: ~ 10 route_prefix: sf_guard_group 11 with_propel_route: 1 6 12 7 list:8 title: Group list9 display: [=name, description]13 config: 14 list: 15 title: Group list 10 16 11 edit:12 title: Edit "%%name%%" group13 fields: 14 permissions: { type: admin_double_list, params: through_class=sfGuardGroupPermission }15 display: [ name, description, permissions ]17 edit: 18 title: Editing Group "%%name%%" 19 20 new: 21 title: New Group plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/actions/actions.class.php
r7634 r12896 1 1 <?php 2 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 3 require_once dirname(__FILE__).'/../lib/sfGuardPermissionGeneratorConfiguration.class.php'; 4 require_once dirname(__FILE__).'/../lib/sfGuardPermissionGeneratorHelper.class.php'; 10 5 11 6 /** 12 * Permission management.13 *14 * @package symfony 15 * @subpackage plugin16 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 17 * @version SVN: $Id$18 */7 * sfGuardPermission actions. 8 * 9 * @package sfGuardPlugin 10 * @subpackage sfGuardPermission 11 * @author Fabien Potencier 12 * @version SVN: $Id$ 13 */ 19 14 class sfGuardPermissionActions extends autosfGuardPermissionActions 20 15 { 21 protected function updatesfGuardPermissionFromRequest()22 {23 $sf_guard_permission = $this->getRequestParameter('sf_guard_permission');24 25 if (isset($sf_guard_permission['name']))26 {27 $this->sf_guard_permission->setName($sf_guard_permission['name']);28 }29 if (isset($sf_guard_permission['description']))30 {31 $this->sf_guard_permission->setDescription($sf_guard_permission['description']);32 }33 if (!empty($sf_guard_permission['module_name']))34 {35 $this->sf_guard_permission->setModuleName($sf_guard_permission['module_name']);36 }37 if (!empty($sf_guard_permission['action_name']))38 {39 $this->sf_guard_permission->setActionName($sf_guard_permission['action_name']);40 }41 }42 16 } plugins/sfGuardPlugin/branches/1.2/modules/sfGuardPermission/config/generator.yml
r7634 r12896 1 1 generator: 2 class: sfPropelAdminGenerator2 class: sfPropelGenerator 3 3 param: 4 model_class: sfGuardPermission 5 theme: default 4 model_class: sfGuardPermission 5 theme: admin 6 non_verbose_templates: true 7 with_show: false 8 singular: ~ 9 plural: ~ 10 route_prefix: sf_guard_permission 11 with_propel_route: 1 6 12 7 list:8 title: Permission list9 display: [=name, description]13 config: 14 list: 15 title: Permission list 10 16 11 edit: 12 title: Edit "%%name%%" permission 17 edit: 18 title: Editing Permission "%%name%%" 19 20 new: 21 title: New Permission plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/actions/actions.class.php
r7634 r12896 1 1 <?php 2 2 3 /* 4 * This file is part of the symfony package. 5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 * For the full copyright and license information, please view the LICENSE 8 * file that was distributed with this source code. 9 */ 10 11 require_once(dirname(__FILE__).'/../lib/BasesfGuardUserActions.class.php'); 3 require_once dirname(__FILE__).'/../lib/sfGuardUserGeneratorConfiguration.class.php'; 4 require_once dirname(__FILE__).'/../lib/sfGuardUserGeneratorHelper.class.php'; 12 5 13 6 /** 14 * User management.7 * sfGuardUser actions. 15 8 * 16 * @package s ymfony17 * @subpackage plugin18 * @author Fabien Potencier <fabien.potencier@symfony-project.com>9 * @package sfGuardPlugin 10 * @subpackage sfGuardUser 11 * @author Fabien Potencier 19 12 * @version SVN: $Id$ 20 13 */ 21 class sfGuardUserActions extends BasesfGuardUserActions14 class sfGuardUserActions extends autoSfGuardUserActions 22 15 { 23 16 } plugins/sfGuardPlugin/branches/1.2/modules/sfGuardUser/config/generator.yml
r12075 r12896 1 1 generator: 2 class: sfPropelAdminGenerator2 class: sfPropelGenerator 3 3 param: 4 model_class: sfGuardUser 5 theme: default 4 model_class: sfGuardUser 5 theme: admin 6 non_verbose_templates: true 7 with_show: false 8 singular: ~ 9 plural: ~ 10 route_prefix: sf_guard_user 11 with_propel_route: 1 6 12 7 fields: 8 password_bis: { name: "Password (again)" } 13 config: 14 fields: 15 password_again: { label: "Password (again)" } 9 16 10 list: 11 title: User list 12 display: [ =username, created_at, last_login ] 13 filters: [ username, _groups ] 17 list: 18 title: User list 19 display: [=username, created_at, last_login] 14 20 15 edit: 16 title: Edit "%%username%%" user 17 fields: 18 password: 19 password_bis: 20 groups: { name: Groups/Roles, type: admin_double_list, params: through_class=sfGuardUserGroup } 21 permissions: { name: permissions, type: admin_check_list, params: through_class=sfGuardUserPermission } 22 last_login: { type: plain } 23 display: 24 "NONE": [ username, _password, _password_bis ] 25 "Information": [ last_login ] 26 "Permissions and groups": [ is_active, groups, permissions ] 21 form: 22 class: sfGuardUserAdminForm 23 display: 24 "NONE": [username, password, password_again] 25 "Permissions and groups": [is_active, is_super_admin, sf_guard_user_group_list, sf_guard_user_permission_list] 26 27 edit: 28 title: Editing User "%%username%%" 29 30 new: 31 title: New User