cob: Properly authorize root actions

Previously, authorization was only checked for ops after the root op.
We also avoid creating empty actions for `assign` and `label`, which
was needed for non-authorized users to be able to create issues/patches.
This commit is contained in:
cloudhead
2024-02-23 12:31:13 +01:00
parent f2be1b2601
commit 87077d5155
2 changed files with 9 additions and 9 deletions
+5 -5
View File
@@ -2053,7 +2053,7 @@ mod routes {
#[tokio::test]
async fn test_projects_issues_create() {
const CREATED_ISSUE_ID: &str = "b2d0999498f98b0d1fa12d859d2d0306380333a0";
const CREATED_ISSUE_ID: &str = "fcd0d5940b55df596cf8079fd1845903f1104bcd";
let tmp = tempfile::tempdir().unwrap();
let ctx = contributor(tmp.path());
@@ -2528,7 +2528,7 @@ mod routes {
#[tokio::test]
async fn test_projects_create_patches() {
const CREATED_PATCH_ID: &str = "e21d5b18f8d6c75cfa9c35186b821b1764cb1ab8";
const CREATED_PATCH_ID: &str = "9aabc4055fd811f915c55e9a6ea9f525aa3e88f2";
let tmp = tempfile::tempdir().unwrap();
let ctx = contributor(tmp.path());
@@ -2835,7 +2835,7 @@ mod routes {
"reviews": [],
},
{
"id": "46fc3974dac96255e73daf2e1169cd929e713064",
"id": "cccf3b0675220f25b054b6625d84611cb6506d9a",
"author": {
"id": CONTRIBUTOR_DID,
},
@@ -3453,7 +3453,7 @@ mod routes {
"timestamp": TIMESTAMP,
"reviews": [
{
"id": "37ed60b8a11949d5db32bce3dd5ab117d3a82841",
"id": "140a44a4eac2cdb74b2f5f95a9dce97847eb9636",
"author": {
"id": CONTRIBUTOR_DID,
},
@@ -3461,7 +3461,7 @@ mod routes {
"summary": "A small review",
"comments": [
{
"id": "9aebcd3b27fabb1700427d8ee7b8958b9a50a8f8",
"id": "0dcfca53416761cf975cc4cd6d452790cee06b49",
"author": {
"id": "did:key:z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8",
},
+4 -4
View File
@@ -32,14 +32,14 @@ pub const HEAD: &str = "e8c676b9e3b42308dc9d218b70faa5408f8e58ca";
pub const PARENT: &str = "ee8d6a29304623a78ebfa5eeed5af674d0e58f83";
pub const INITIAL_COMMIT: &str = "f604ce9fd5b7cc77b7609beda45ea8760bee78f7";
pub const DID: &str = "did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi";
pub const ISSUE_ID: &str = "45d118885b6b06360ee539573f5ceb24be2979f8";
pub const ISSUE_DISCUSSION_ID: &str = "d11b03464c9bf58b09460713c8e2c74f0725d3bd";
pub const ISSUE_COMMENT_ID: &str = "e3aa754cb47d2299781fed49cc91c4b41e06c219";
pub const ISSUE_ID: &str = "ca67d195c0b308b51810dedd93157a20764d5db5";
pub const ISSUE_DISCUSSION_ID: &str = "41e2823caa54f1d53e375035ed4aabd0a89fa855";
pub const ISSUE_COMMENT_ID: &str = "e9f963fab82ad875e46b29a327c5d3d51f825cdc";
pub const SESSION_ID: &str = "u9MGAkkfkMOv0uDDB2WeUHBT7HbsO2Dy";
pub const TIMESTAMP: u64 = 1671125284;
pub const CONTRIBUTOR_RID: &str = "rad:z4XaCmN3jLSeiMvW15YTDpNbDHFhG";
pub const CONTRIBUTOR_DID: &str = "did:key:z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8";
pub const CONTRIBUTOR_PATCH_ID: &str = "89ddf1bf50a6e98f41372e8d554b4ac8e37e7d36";
pub const CONTRIBUTOR_PATCH_ID: &str = "3e3f0dc34b3eeb64cfbc7218fbd52b97246e0564";
/// Create a new profile.
pub fn profile(home: &Path, seed: [u8; 32]) -> radicle::Profile {