Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class myUser extends sfGuardSecurityUser {
- /**
- * Returns the id of the logged in User
- * @return int
- * @author Ayoub Hidri
- */
- public function getId() {
- return $this->getAttribute('user_id', null, 'sfGuardSecurityUser');
- }
- public function signin($user, $remember = false, $con = null) {
- $attributes = array(
- 'username'=>'getUsername',
- 'last_login'=>'getLastLogin',
- 'birthdate'=>'getBirthdate',
- 'first_name'=>'getFirstName',
- 'last_name'=>'getLastName',
- );
- $this->setAttributes($user, $attributes);
- $this->setAttribute('permissions', $user->getAllPermissionNames(),'sfGuardSecurityUser');
- $this->setAttribute('permissions', $user->getAllPermissionNames(),'sfGuardSecurityUser');
- parent::signIn($user, $remember, $con);
- }
- /**
- * Sets Attributes to the sfGuardSecurityUser attributeHolder name space
- */
- private function setAttributes($user,$attributes) {
- foreach ($attributes as $name=>$method) {
- $this->setAttribute($name, $user->$method(), 'sfGuardSecurityUser');
- }
- }
- }
Add Comment
Please, Sign In to add comment