Documentation is available at _auth.php
- <?php
- class net_nemein_registrations__auth {
- var $_midgard;
- var $_person;
- var $_ispoweruser;
- var $_topic;
- var $_config;
- function net_nemein_registrations__auth ($topic, $config) {
- $this->_topic = $topic;
- $this->_config = $config;
- $this->auth_sync_with_midgard();
- }
- function get_midgard() { return $this->_midgard; }
- function get_person() { return $this->_person; }
- function is_poweruser() { return $this->_ispoweruser; }
- function auth_sync_with_midgard() {
- $this->_clear_privileges();
- $this->_midgard = mgd_get_midgard();
- $this->_person = mgd_get_person($this->_midgard->user);
- if (! $this->_person)
- $this->_person = null;
- $this->_read_privileges();
- }
- function auth_registrar (&$regfact, $email, $password) {
- $person = $regfact->getby_email($email);
- if (is_null($person)) {
- debug_add("could not get person record for '$email'");
- $this->auth_sync_with_midgard();
- return false;
- }
- if ($person->parameter("net.nemein.registrations", "password") != $password) {
- debug_add("Passwords do not match, got '$password', should be '"
- . $person->parameter("net.nemein.registrations", "password") . "'");
- $this->auth_sync_with_midgard();
- return false;
- }
- $this->_person = $person;
- $this->_read_privileges();
- return true;
- }
- function _read_privileges() {
- if (is_null ($this->_person)) {
- $this->_clear_privileges();
- } else {
- if ($this->_person->id == $this->_midgard->user && $this->_midgard->admin)
- $this->_is_poweruser = true;
- else
- $this->_ispoweruser = $this->_person->parameter("Interface","Power_User") != "NO" ? true : false;
- }
- }
- function _clear_privileges() {
- $this->_person = null;
- $this->_ispoweruser = false;
- }
- }
- ?>
Documentation generated on Mon, 21 Nov 2005 18:25:04 +0100 by phpDocumentor 1.3.0RC3