* sepgsql_relation_truncate * * Check privileges to TRUNCATE the supplied relation. */
| 521 | * Check privileges to TRUNCATE the supplied relation. |
| 522 | */ |
| 523 | void |
| 524 | sepgsql_relation_truncate(Oid relOid) |
| 525 | { |
| 526 | ObjectAddress object; |
| 527 | char *audit_name; |
| 528 | uint16_t tclass = 0; |
| 529 | char relkind = get_rel_relkind(relOid); |
| 530 | |
| 531 | switch (relkind) |
| 532 | { |
| 533 | case RELKIND_RELATION: |
| 534 | case RELKIND_PARTITIONED_TABLE: |
| 535 | tclass = SEPG_CLASS_DB_TABLE; |
| 536 | break; |
| 537 | default: |
| 538 | /* ignore other relkinds */ |
| 539 | return; |
| 540 | } |
| 541 | |
| 542 | /* |
| 543 | * check db_table:{truncate} permission |
| 544 | */ |
| 545 | object.classId = RelationRelationId; |
| 546 | object.objectId = relOid; |
| 547 | object.objectSubId = 0; |
| 548 | audit_name = getObjectIdentity(&object, false); |
| 549 | |
| 550 | sepgsql_avc_check_perms(&object, |
| 551 | tclass, |
| 552 | SEPG_DB_TABLE__TRUNCATE, |
| 553 | audit_name, |
| 554 | true); |
| 555 | pfree(audit_name); |
| 556 | } |
| 557 | |
| 558 | /* |
| 559 | * sepgsql_relation_relabel |
no test coverage detected