Skip to content
DAO.php 2.56 KiB
Newer Older
<?php

/* ----------------------------------------------------------------------------
 *               INAF - National Institute for Astrophysics
 *               IRA  - Radioastronomical Institute - Bologna
 *               OATS - Astronomical Observatory - Trieste
 * ----------------------------------------------------------------------------
 *
 * Copyright (C) 2016 Istituto Nazionale di Astrofisica
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License Version 3 as published by the
 * Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

namespace RAP;

    public abstract function getDBHandler();
    public abstract function createLoginToken($token, $userId);
    public abstract function findLoginToken($token);
    public abstract function deleteLoginToken($token);
    /**
     * Return the new identity ID.
     */
    public abstract function insertIdentity(Identity $identity, $userId);
    /**
     * Return the new user ID.
     */
    public abstract function createUser();
    public abstract function findUserById($userId);
    /**
     * Return a User object, null if nothing was found.
     * @param type $type Identity type (EDU_GAIN, X509, GOOGLE, ...)
     * @param type $identifier value used to search the identity in the database
     */
Sonia Zorba's avatar
Sonia Zorba committed
    public abstract function findUserByIdentity($type, $identifier);
    public abstract function searchUser($searchText);

    public abstract function addEmailToUser($email, $userId);
    public abstract function createJoinRequest($token, $applicantUserId, $targetUserId);

    public abstract function findJoinRequest($token);
    public abstract function deleteUser($userId);

    public abstract function joinUsers($userId1, $userId2);
    
    public abstract function deleteJoinRequest($token);
        global $DATABASE;

        switch ($DATABASE['dbtype']) {
                return new MySQLDAO($DATABASE);
                throw new \Exception($DATABASE['dbtype'] . ' not supported yet');