root/trunk/apps/main/lib/myUser.class.php

Revision 79, 1.1 kB (checked in by nperriault, 2 years ago)

[1.1] Updated functional tests, migrated Job form

Line 
1 <?php
2 /**
3  * Session handling class
4  *
5  */
6 class myUser extends sfGuardSecurityUser
7 {
8
9   /**
10    * Retrieves current user PK, if any
11    *
12    * @return int
13    */
14   public function getId()
15   {
16     return $this->getAttribute('user_id', null, 'sfGuardSecurityUser');
17   }
18
19   /**
20    * Retrieves current sfGuardUser associated to current session, if any.
21    * Note: it's just here to have typed phpdoc for autocompletion in Eclipse PDT
22    *
23    * @return sfGuardUser
24    */
25   public function getGuardUser()
26   {
27     return parent::getGuardUser();
28   }
29
30   /**
31    * Returns current session storage instance
32    *
33    * @return sfSessionStorage
34    */
35   public function getStorage()
36   {
37     return $this->storage;
38   }
39
40   /**
41    * Retrieves related user companies
42    *
43    * @return array
44    */
45   public function getRelatedCompanies()
46   {
47     return $this->getGuardUser()->getCompaniesArray($this->isAdmin() ? 'all' : 'related');
48   }
49
50   /**
51    * Checks if current connected user is an admin
52    *
53    * @return boolean
54    */
55   public function isAdmin()
56   {
57     return $this->hasCredential('admin') or $this->isSuperAdmin();
58   }
59
60 }
61
Note: See TracBrowser for help on using the browser.