* ExecCheckRTPerms * Check access permissions for all relations listed in a range table. * * Returns true if permissions are adequate. Otherwise, throws an appropriate * error if ereport_on_violation is true, or simply returns false otherwise. * * Note that this does NOT address row-level security policies (aka: RLS). If * rows will be returned to the user as a result of this permission
| 1446 | * See rewrite/rowsecurity.c. |
| 1447 | */ |
| 1448 | bool |
| 1449 | ExecCheckRTPerms(List *rangeTable, bool ereport_on_violation) |
| 1450 | { |
| 1451 | ListCell *l; |
| 1452 | bool result = true; |
| 1453 | |
| 1454 | foreach(l, rangeTable) |
| 1455 | { |
| 1456 | RangeTblEntry *rte = (RangeTblEntry *) lfirst(l); |
| 1457 | |
| 1458 | result = ExecCheckRTEPerms(rte); |
| 1459 | if (!result) |
| 1460 | { |
| 1461 | Assert(rte->rtekind == RTE_RELATION); |
| 1462 | if (ereport_on_violation) |
| 1463 | aclcheck_error(ACLCHECK_NO_PRIV, get_relkind_objtype(get_rel_relkind(rte->relid)), |
| 1464 | get_rel_name(rte->relid)); |
| 1465 | return false; |
| 1466 | } |
| 1467 | } |
| 1468 | |
| 1469 | if (ExecutorCheckPerms_hook) |
| 1470 | result = (*ExecutorCheckPerms_hook) (rangeTable, |
| 1471 | ereport_on_violation); |
| 1472 | return result; |
| 1473 | } |
| 1474 | |
| 1475 | /* |
| 1476 | * ExecCheckRTEPerms |
no test coverage detected