Ignore:
Timestamp:
02/20/12 16:27:19 (13 years ago)
Author:
hendrikvanantwerpen
Message:
  • [Client] Moved pages in subtree of rft/, allowing controllers next to them.
  • [Client] Created questions page, gives overview and allows adding.
  • [Client] Page controllers inherit from _Page, because the previous mechanism w

asn't working.

  • [Client] Added new user registration.
  • [Server] Changed user passwords to passwordHash/passwordSalt combination.
  • [Server] Added simple object marshalling and unmarshalling to preserve types.
  • [Server] Added ResearchToolObjectInterface? with static create() method. Implemented for all model classes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/server/classes/models/Respondent.php

    r256 r274  
    1616
    1717        public $email;
    18         public $password;
     18        public $passwordHash;
     19        public $passwordSalt;
    1920
    2021        /**
     
    2425         * @param type password
    2526         */
    26         public function __construct($uid = null, $email = null, $password = null)
     27        public function __construct($uid = null, $email = null, $passwordHash = null, $passwordSalt = null)
    2728        {
    2829        if(!isset($uid))
     
    3334        $this->uid = $uid;
    3435        $this->email = $email;
    35         $this->password = $password;
     36        $this->passwordHash = $passwordHash;
     37        $this->passwordSalt = $passwordSalt;
    3638        }
    3739    /**
     
    6466        $model->add(new Statement($resourceRespondent,$predicateName,$literalRespondentName));                 
    6567
    66         $literalPassword = new Literal($this->password);
    67         $predicatePassword = new Resource(PASSWORD);
    68         $model->add(new Statement($resourceRespondent,$predicatePassword,$literalPassword));
     68        $literalPasswordHash = new Literal($this->passwordHash);
     69        $predicatePasswordHash = new Resource(PASSWORDHASH);
     70        $model->add(new Statement($resourceRespondent,$predicatePasswordHash,$literalPasswordHash));
     71       
     72        $literalPasswordSalt = new Literal($this->passwordSalt);
     73        $predicatePasswordSalt = new Resource(PASSWORDSALT);
     74        $model->add(new Statement($resourceRespondent,$predicatePasswordSalt,$literalPasswordSalt));
     75       
    6976                $model->saveAs(Respondent::$filename, 'rdf');
    7077                return true;
     
    8592            PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    8693            PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    87             SELECT ?uid, ?email, ?password
     94            SELECT ?uid, ?email, ?passwordHash, ?passwordSalt
    8895            WHERE       
    8996            {
     
    9198                                        predicates:uid ?uid ;
    9299                                        predicates:email ?email ;
    93                                         predicates:password ?password ;
     100                                        predicates:passwordHash ?passwordHash ;
     101                                        predicates:passwordSalt ?passwordSalt ;
    94102                                        ' . ResearchToolObject::createArguments($arguments) .  '
    95103            }';
     
    102110            foreach($results as $result)
    103111            {
    104                     $respondents[] = new Respondent($result['?uid']->label, $result['?email']->label, $result['?password']->label);
     112                    $respondents[] = new Respondent($result['?uid']->label, $result['?email']->label, $result['?passwordHash']->label, $result['?passwordSalt']->label);
    105113            }
    106114        }
    107115        return $respondents;
    108116        }
     117
     118    public static function create($obj) {
     119        return new Respondent($obj->uid, $obj->email, $obj->passwordHash, $obj->passwordSalt);
     120    }
     121
    109122}
    110123
    111        
    112 
    113 
    114 
     124?>
Note: See TracChangeset for help on using the changeset viewer.