src/snac/server/database/SQL.php
/**
     * Really delete a privilege
     *
     * Used for testing only, maybe. In any case, deleting a privilege should be rare. To make this a little safer
     * it only deletes if the privilege is not in use.
     *
     * @throws \snac\exceptions\SNACDatabaseException
     *
     * @param integer $privilegeID An privilege id
     */
Really delete a privilege
Used for testing only, maybe. In any case, deleting a privilege should be rare. To make this a little safer
it only deletes if the privilege is not in use.



@param integer $privilegeID An privilege id
Really delete a privilege Used for testing only maybe . In any case deleting a privilege should be rare . To make this a little safer it only deletes if the privilege is not in use . @param integer $privilegeID An privilege id
public function deletePrivilege($privilegeID)
    {
        $result = $this->sdb->query(
            'select role.label from role,privilege_role_link as prl where prl.pid=$1 and prl.rid=role.id',
            array($privilegeID));
        $labels = "";
        while($row = $this->sdb->fetchrow($result))
        {
            $labels .= $row['label'] . " ";
        }
        if ($labels)
        {
            throw new \snac\exceptions\SNACDatabaseException("Tried to delete privilege still used by roles: $labels");
        }
        else
        {
            $this->sdb->query(
                'delete from privilege where id=$1 and id not in (select distinct(pid) from privilege_role_link)',
                array($privilegeID));
        }
    }
public function deletePrivilege ( $ privilegeID ) { $ result = $ this -> sdb -> query ( 'select role.label from role,privilege_role_link as prl where prl.pid=$1 and prl.rid=role.id' , array ( $ privilegeID ) ) ; $ labels = " " ; while ( $ row = $ this -> sdb -> fetchrow ( $ result ) ) { $ labels .= $ row [ 'label' ] . " " ; } if ( $ labels ) { throw new \ snac \ exceptions \ SNACDatabaseException ( " Tried to delete privilege still used by roles:  $ labels " ) ; } else { $ this -> sdb -> query ( 'delete from privilege where id=$1 and id not in (select distinct(pid) from privilege_role_link)' , array ( $ privilegeID ) ) ; } }
Really delete a privilege
 Used for testing only, maybe.
Really delete a privilege Used for testing only maybe .