Esempio n. 1
0
 /**
  * Create auth adapter
  *
  * @param string $rolefile File containing XML with users and roles
  */
 public function __construct($rolefile)
 {
     $this->_acl = new Acl();
     $xml = XmlSecurity::scanFile($rolefile);
     /*
     Roles file format:
      <roles>
        <role id=”admin”>
             <user name=”user1” password=”pwd”/>
         </role>
        <role id=”hr”>
             <user name=”user2” password=”pwd2”/>
         </role>
     </roles>
     */
     foreach ($xml->role as $role) {
         $this->_acl->addRole(new \fproject\amf\acl\Role((string) $role["id"]));
         foreach ($role->user as $user) {
             $this->_users[(string) $user["name"]] = array("password" => (string) $user["password"], "role" => (string) $role["id"]);
         }
     }
 }