myUser.class.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. class myUser extends sfBasicSecurityUser {
  3. public function signIn($form_values) {
  4. $katao_user =/*(KataoUser)*/ KataoUserPeer::getUserByLoginAndPassword($form_values['login'], $form_values['password']);
  5. setlocale(LC_TIME, 'fr');
  6. $this->setInstance($katao_user);
  7. // Credentials and authentication:
  8. $this->addCredentials($katao_user->getCredentials());
  9. $this->setAuthenticated(true);
  10. $this->setCulture('fr');
  11. }
  12. public function signOut() {
  13. $this->setAuthenticated(false);
  14. $this->clearCredentials();
  15. $this->getAttributeHolder()->removeNamespace();
  16. }
  17. public function setInstance(KataoUser $user) {
  18. return $this->setAttribute('user', $user);
  19. }
  20. public function getInstance() {
  21. return $this->getAttribute('user', null);
  22. }
  23. public function isJustDelegate() {
  24. return !$this->hasCredential('admin') && !$this->hasCredential('seo') && !$this->hasCredential('supplier') && $this->hasCredential('delegate') && !$this->hasCredential('referer');
  25. }
  26. public function isJustReferer() {
  27. return !$this->hasCredential('admin') && !$this->hasCredential('seo') && !$this->hasCredential('supplier') && !$this->hasCredential('delegate') && $this->hasCredential('referer');
  28. }
  29. public function isJustSupplier() {
  30. return !$this->hasCredential('admin') && !$this->hasCredential('seo') && $this->hasCredential('supplier') && !$this->hasCredential('delegate') && !$this->hasCredential('referer');
  31. }
  32. }