/** * Load grants between two people. Note that this load is unidirectional, between a grantor and a grantee. */ public static function load_grants(MyRelationshipPerson $grantor, MyRelationshipPerson $grantee) { $sql = "\n\t\t\tSELECT *\n\t\t\tFROM relgrants rg\n\t\t\tWHERE\n\t\t\t\trg.wpid_grantor = ? AND\n\t\t\t\trg.wpid_grantee = ?\n\t\t"; $args = array($grantor->wpid, $grantee->wpid); $rset = PSU::db('portal')->Execute($sql, $args); $grants = array(); foreach ($rset as $row) { $permission = MyPermission::load($row['relpermission_id']); $grant = new self($row['id'], $grantor, $grantee, $permission, strtotime($row['activity_date'])); $grants[$permission->code] = $grant; unset($grant); } return $grants; }