myUser.class.php 428 B

1234567891011121314151617181920
  1. <?php
  2. class myUser extends sfBasicSecurityUser
  3. {
  4. /* default is null */
  5. static $groupPrecedence = array('www','staff','users');
  6. /* chooses from credentials and sets attribute */
  7. public function setGroup()
  8. {
  9. $value = 'all';
  10. $credentials = $this->listCredentials();
  11. foreach (self::$groupPrecedence as $group)
  12. {
  13. if (in_array($group, $credentials)) $value = $group;
  14. }
  15. $this->setAttribute('group', $value);
  16. }
  17. }