Skip to content

Commit

Permalink
feat: move permissions policy set to mutable data
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Apr 26, 2024
1 parent 0228519 commit 1b21fb0
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 63 deletions.
62 changes: 0 additions & 62 deletions proto/mls/message_contents/group_metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ option java_package = "org.xmtp.proto.mls.message.contents";
message GroupMetadataV1 {
ConversationType conversation_type = 1;
string creator_account_address = 2;
PolicySet policies = 3;
}

// Defines the type of conversation
Expand All @@ -19,64 +18,3 @@ enum ConversationType {
CONVERSATION_TYPE_GROUP = 1;
CONVERSATION_TYPE_DM = 2;
}

// The set of policies that govern the group
message PolicySet {
MembershipPolicy add_member_policy = 1;
MembershipPolicy remove_member_policy = 2;
map<string, MetadataPolicy> update_metadata_policy = 3;
}

// A policy that governs adding/removing members or installations
message MembershipPolicy {
// Base policy
enum BasePolicy {
BASE_POLICY_UNSPECIFIED = 0;
BASE_POLICY_ALLOW = 1;
BASE_POLICY_DENY = 2;
BASE_POLICY_ALLOW_IF_ACTOR_CREATOR = 3;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MembershipPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MembershipPolicy policies = 1;
}

oneof kind {
BasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}

// A policy that governs updating metadata
message MetadataPolicy {
// Base policy
enum MetadataBasePolicy {
METADATA_BASE_POLICY_UNSPECIFIED = 0;
METADATA_BASE_POLICY_ALLOW = 1;
METADATA_BASE_POLICY_DENY = 2;
METADATA_BASE_POLICY_ALLOW_IF_ACTOR_CREATOR = 3;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MetadataPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MetadataPolicy policies = 1;
}

oneof kind {
MetadataBasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}
66 changes: 65 additions & 1 deletion proto/mls/message_contents/group_mutable_metadata.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,69 @@ option java_package = "org.xmtp.proto.mls.message.contents";

// Message for group mutable metadata
message GroupMutableMetadataV1 {
map<string, string> attributes = 1; // Map to store various metadata attributes
// Map to store various metadata attributes (Group name, etc.)
map<string, string> attributes = 1;
PolicySet policies = 2;
}

// The set of policies that govern the group
message PolicySet {
MembershipPolicy add_member_policy = 1;
MembershipPolicy remove_member_policy = 2;
map<string, MetadataPolicy> update_metadata_policy = 3;
}

// A policy that governs adding/removing members or installations
message MembershipPolicy {
// Base policy
enum BasePolicy {
BASE_POLICY_UNSPECIFIED = 0;
BASE_POLICY_ALLOW = 1;
BASE_POLICY_DENY = 2;
BASE_POLICY_ALLOW_IF_ACTOR_CREATOR = 3;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MembershipPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MembershipPolicy policies = 1;
}

oneof kind {
BasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}

// A policy that governs updating metadata
message MetadataPolicy {
// Base policy
enum MetadataBasePolicy {
METADATA_BASE_POLICY_UNSPECIFIED = 0;
METADATA_BASE_POLICY_ALLOW = 1;
METADATA_BASE_POLICY_DENY = 2;
METADATA_BASE_POLICY_ALLOW_IF_ACTOR_CREATOR = 3;
}

// Combine multiple policies. All must evaluate to true
message AndCondition {
repeated MetadataPolicy policies = 1;
}

// Combine multiple policies. Any must evaluate to true
message AnyCondition {
repeated MetadataPolicy policies = 1;
}

oneof kind {
MetadataBasePolicy base = 1;
AndCondition and_condition = 2;
AnyCondition any_condition = 3;
}
}

0 comments on commit 1b21fb0

Please sign in to comment.