1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace Shibboleth;
- require_once __DIR__.'/scaffold/user.class.php';
- class User extends _User
- {
-
- }
- class UserStore extends _UserStore
- {
- function __construct()
- {
- parent::__construct();
- ShibbolethUpgrade::update();
- }
-
- public function get_by_shibboleth_id($id)
- {
- return $this->get(array('shibb_unique_id' => $id));
- }
-
-
- public function shibboleth_id_exists($id)
- {
- return $this->exist(array('shibb_unique_id' => $id));
- }
-
- protected function before_save($object)
- {
- $object->username = $object->username ? $object->username : $this->generate_username();
- $object->password = $object->password ? $object->password : api_generate_password();
- $object->language = $object->language ? $object->language : $this->default_language();
- }
-
- function default_language()
- {
- return api_get_setting('platformLanguage');
- }
- function generate_username()
- {
- $result = uniqid('s', true);
- $result = str_replace('.', '', $result);
- while ($this->username_exists($result))
- {
- $result = uniqid('s', true);
- $result = str_replace('.', '', $result);
- }
- return $result;
- }
- }
|