src/snac/server/database/DBUser.php
/**
     * Write or update a new role to the database
     *
     * Linked privileges have to exist before the role, logically. A privilege must have an ID in order to be
     * linked to a role, and a privilege doesn't have an ID until that privilege has been written to the
     * database.
     *
     * @param \snac\data\Role $role The role objectc.
     *
     * @return \snac\data\Role Role object.
     */
Write or update a new role to the database
Linked privileges have to exist before the role, logically. A privilege must have an ID in order to be
linked to a role, and a privilege doesn't have an ID until that privilege has been written to the
database.

@param \snac\data\Role $role The role objectc.

@return \snac\data\Role Role object.
Write or update a new role to the database Linked privileges have to exist before the role logically . A privilege must have an ID in order to be linked to a role and a privilege doesn ' t have an ID until that privilege has been written to the database . @param \ snac \ data \ Role $role The role objectc . @return \ snac \ data \ Role Role object .
public function writeRole($role)
    {
        if ($role->getID())
        {
            $this->sql->updateRole($role->getID(),
                                   $role->getLabel(),
                                   $role->getDescription());
        }
        else
        {
            $rid = $this->sql->insertRole($role->getLabel(),
                                          $role->getDescription());
            $role->setID($rid);
        }
        foreach($role->getPrivilegeList() as $priv)
        {
            $this->sql->insertPrivilegeRoleLink($role->getID(), $priv->getID());
        }
                return $role;
    }
public function writeRole ( $ role ) { if ( $ role -> getID ( ) ) { $ this -> sql -> updateRole ( $ role -> getID ( ) , $ role -> getLabel ( ) , $ role -> getDescription ( ) ) ; } else { $ rid = $ this -> sql -> insertRole ( $ role -> getLabel ( ) , $ role -> getDescription ( ) ) ; $ role -> setID ( $ rid ) ; } foreach ( $ role -> getPrivilegeList ( ) as $ priv ) { $ this -> sql -> insertPrivilegeRoleLink ( $ role -> getID ( ) , $ priv -> getID ( ) ) ; } return $ role ; }
Write or update a new role to the database
 Linked privileges have to exist before the role, logically.
Write or update a new role to the database Linked privileges have to exist before the role logically .
// Objects are passed by referece. How does it make sense to return an arg passed by reference?
