Exemple #1
0
 /**
  * Sets up a CIF LDAP connection and creates a test user before running the AFS tests.
  */
 public static function setUpBeforeClass()
 {
     try {
         // Authenticate as a priviledged user through Kerberos
         self::$kerberos = new CifKerberos();
         // Connect to CIF LDAP and create a new test user
         self::$ldap = CifLdap::get_connection();
         self::$ldap->create_user(self::get_ldap_properties(), 'password');
         // Password is "password"
     } catch (Exception $e) {
         echo "\nError: " . $e->getMessage();
         echo self::$ldap->get_log();
     }
 }
Exemple #2
0
 /**
  * Authenticates through Kerberos for privileged permissions.
  * This also creates our CIF user.
  */
 public static function setUpBeforeClass()
 {
     // Authenticate as a priviledged user through Kerberos
     self::$kerberos = new CifKerberos();
     self::$database = new CifMysql(DATABASE_HOSTNAME, DATABASE_ADMIN_USER, DATABASE_ADMIN_PASSWORD);
     self::$ldap = CifLdap::get_connection();
     // Create an LDAP test group
     self::$ldap->create_group(self::$test_group);
     try {
         // Create the CIF user from our desired attributes
         self::$user = CifUser::create_from(self::get_properties(), self::$password);
     } catch (Exception $e) {
         echo "\n" . self::$user->get_log();
         $this->fail($e->getMessage());
     }
 }
Exemple #3
0
 /**
  * Initializes the private connections to CIF LDAP.
  * This should be called immediately after the class definition
  * to ensure that these static properties are available.
  */
 public static function initialize_connections()
 {
     self::$cif_kerberos = new CifKerberos();
     self::$cif_ldap = CifLdap::get_connection();
 }
Exemple #4
0
 /**
  * Ensures that a CifLdap connection is initialized.
  */
 public function __construct()
 {
     CifLdap::get_connection();
 }
Exemple #5
0
 /**
  * Invalidates the cache, requiring a new LDAP read to be performed.
  * This should be called whenever fields in LDAP are updated.
  */
 protected function invalidate_cache()
 {
     self::$cached_user = null;
 }