Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: ADR-014: Permissions improvements #886

Merged
merged 22 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: feat
module: x/subspaces
pull_request: 886
description: Improved how permissions are managed
backward_compatible: false
date: 2022-06-07T10:03:15.871498535Z
103 changes: 59 additions & 44 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4044,7 +4044,7 @@ paths:
format: boolean
tags:
- Query
/desmos/subspaces/v1/subspaces:
/desmos/subspaces/v2/subspaces:
get:
summary: Subspaces queries all the subspaces inside Desmos
operationId: Subspaces
Expand Down Expand Up @@ -4203,7 +4203,7 @@ paths:
format: boolean
tags:
- Query
'/desmos/subspaces/v1/subspaces/{subspace_id}':
'/desmos/subspaces/v2/subspaces/{subspace_id}':
get:
summary: >-
Subspace queries all the information about the subspace with the given
Expand Down Expand Up @@ -4280,7 +4280,7 @@ paths:
format: uint64
tags:
- Query
'/desmos/subspaces/v1/subspaces/{subspace_id}/groups':
'/desmos/subspaces/v2/subspaces/{subspace_id}/groups':
get:
summary: >-
UserGroups queries all the groups that are present inside the subspace
Expand Down Expand Up @@ -4320,8 +4320,9 @@ paths:
type: string
title: Optional description of this group
permissions:
type: integer
format: int64
type: array
items:
type: string
title: >-
Permissions that will be granted to all the users part
of this group
Expand Down Expand Up @@ -4453,7 +4454,7 @@ paths:
format: boolean
tags:
- Query
'/desmos/subspaces/v1/subspaces/{subspace_id}/groups/{group_id}':
'/desmos/subspaces/v2/subspaces/{subspace_id}/groups/{group_id}':
get:
summary: |-
UserGroup queries the user group having the given id inside the specific
Expand Down Expand Up @@ -4489,8 +4490,9 @@ paths:
type: string
title: Optional description of this group
permissions:
type: integer
format: int64
type: array
items:
type: string
title: >-
Permissions that will be granted to all the users part of
this group
Expand Down Expand Up @@ -4535,7 +4537,7 @@ paths:
format: int64
tags:
- Query
'/desmos/subspaces/v1/subspaces/{subspace_id}/groups/{group_id}/members':
'/desmos/subspaces/v2/subspaces/{subspace_id}/groups/{group_id}/members':
get:
summary: UserGroupMembers queries all the members of a given user group
operationId: UserGroupMembers
Expand Down Expand Up @@ -4672,7 +4674,7 @@ paths:
format: boolean
tags:
- Query
'/desmos/subspaces/v1/subspaces/{subspace_id}/permissions/{user}':
'/desmos/subspaces/v2/subspaces/{subspace_id}/permissions/{user}':
get:
summary: UserPermissions queries the permissions for the given user
operationId: UserPermissions
Expand All @@ -4683,8 +4685,9 @@ paths:
type: object
properties:
permissions:
type: integer
format: int64
type: array
items:
type: string
details:
type: array
items:
Expand All @@ -4706,9 +4709,10 @@ paths:
type: string
title: User for which the permission was set
permission:
type: integer
format: int64
title: Permission set to the user
type: array
items:
type: string
title: Permissions set to the user
group:
title: Group represents a group permission
type: object
Expand All @@ -4718,9 +4722,10 @@ paths:
format: int64
title: Unique id of the group
permission:
type: integer
format: int64
title: Permission set to the group
type: array
items:
type: string
title: Permissions set to the group
title: PermissionDetail contains the details data of a permission
title: |-
QueryUserPermissionsRequest is the response type for the
Expand Down Expand Up @@ -12232,9 +12237,10 @@ definitions:
type: string
title: User for which the permission was set
permission:
type: integer
format: int64
title: Permission set to the user
type: array
items:
type: string
title: Permissions set to the user
group:
title: Group represents a group permission
type: object
Expand All @@ -12244,9 +12250,10 @@ definitions:
format: int64
title: Unique id of the group
permission:
type: integer
format: int64
title: Permission set to the group
type: array
items:
type: string
title: Permissions set to the group
title: PermissionDetail contains the details data of a permission
desmos.subspaces.v2.PermissionDetail.Group:
type: object
Expand All @@ -12256,9 +12263,10 @@ definitions:
format: int64
title: Unique id of the group
permission:
type: integer
format: int64
title: Permission set to the group
type: array
items:
type: string
title: Permissions set to the group
title: Group is a permission that has been set to a user group
desmos.subspaces.v2.PermissionDetail.User:
type: object
Expand All @@ -12267,9 +12275,10 @@ definitions:
type: string
title: User for which the permission was set
permission:
type: integer
format: int64
title: Permission set to the user
type: array
items:
type: string
title: Permissions set to the user
title: User is a permission that has been set to a specific user
desmos.subspaces.v2.QuerySectionResponse:
type: object
Expand Down Expand Up @@ -12509,8 +12518,9 @@ definitions:
type: string
title: Optional description of this group
permissions:
type: integer
format: int64
type: array
items:
type: string
title: >-
Permissions that will be granted to all the users part of this
group
Expand Down Expand Up @@ -12545,8 +12555,9 @@ definitions:
type: string
title: Optional description of this group
permissions:
type: integer
format: int64
type: array
items:
type: string
title: >-
Permissions that will be granted to all the users part of this
group
Expand Down Expand Up @@ -12583,8 +12594,9 @@ definitions:
type: object
properties:
permissions:
type: integer
format: int64
type: array
items:
type: string
details:
type: array
items:
Expand All @@ -12606,9 +12618,10 @@ definitions:
type: string
title: User for which the permission was set
permission:
type: integer
format: int64
title: Permission set to the user
type: array
items:
type: string
title: Permissions set to the user
group:
title: Group represents a group permission
type: object
Expand All @@ -12618,9 +12631,10 @@ definitions:
format: int64
title: Unique id of the group
permission:
type: integer
format: int64
title: Permission set to the group
type: array
items:
type: string
title: Permissions set to the group
title: PermissionDetail contains the details data of a permission
title: |-
QueryUserPermissionsRequest is the response type for the
Expand Down Expand Up @@ -12700,8 +12714,9 @@ definitions:
type: string
title: Optional description of this group
permissions:
type: integer
format: int64
type: array
items:
type: string
title: Permissions that will be granted to all the users part of this group
title: UserGroup represents a group of users
desmos.posts.v1.Attachment:
Expand Down
11 changes: 0 additions & 11 deletions proto/desmos/subspaces/v2/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@ message SubspaceData {
uint32 next_section_id = 3 [ (gogoproto.customname) = "NextSectionID" ];
}

// UserPermission represents a single Access Control List entry
message UserPermission {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;

uint64 subspace_id = 1 [ (gogoproto.customname) = "SubspaceID" ];
uint32 section_id = 2 [ (gogoproto.customname) = "SectionID" ];
string user = 3;
uint32 permissions = 4;
}

// UserGroupMemberEntry contains the details of a user group member
message UserGroupMemberEntry {
option (gogoproto.equal) = true;
Expand Down
16 changes: 15 additions & 1 deletion proto/desmos/subspaces/v2/models.proto
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,19 @@ message UserGroup {
string description = 5 [ (gogoproto.moretags) = "yaml:\"description\"" ];

// Permissions that will be granted to all the users part of this group
uint32 permissions = 6 [ (gogoproto.moretags) = "yaml:\"permissions\"" ];
repeated string permissions = 6 [
(gogoproto.castrepeated) = "Permissions",
(gogoproto.moretags) = "yaml:\"permissions\""
];
}

// UserPermission represents a single Access Control List entry
message UserPermission {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;

uint64 subspace_id = 1 [ (gogoproto.customname) = "SubspaceID" ];
uint32 section_id = 2 [ (gogoproto.customname) = "SectionID" ];
string user = 3;
repeated string permissions = 4 [ (gogoproto.castrepeated) = "Permissions" ];
}
8 changes: 5 additions & 3 deletions proto/desmos/subspaces/v2/msgs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ message MsgCreateUserGroup {
string description = 4 [ (gogoproto.moretags) = "yaml:\"description\"" ];

// Default permissions to be applied to the group
uint32 default_permissions = 5
repeated string default_permissions = 5
[ (gogoproto.moretags) = "yaml:\"default_permissions\"" ];

// Creator of the group
Expand Down Expand Up @@ -339,7 +339,8 @@ message MsgSetUserGroupPermissions {
];

// New permissions to be set to the group
uint32 permissions = 3 [ (gogoproto.moretags) = "yaml:\"permissions\"" ];
repeated string permissions = 3
[ (gogoproto.moretags) = "yaml:\"permissions\"" ];

// User setting the new permissions
string signer = 4 [ (gogoproto.moretags) = "yaml:\"signer\"" ];
Expand Down Expand Up @@ -445,7 +446,8 @@ message MsgSetUserPermissions {
string user = 3 [ (gogoproto.moretags) = "yaml:\"user\"" ];

// Permissions to be set to the user
uint32 permissions = 4 [ (gogoproto.moretags) = "yaml:\"permissions\"" ];
repeated string permissions = 4
[ (gogoproto.moretags) = "yaml:\"permissions\"" ];

// User signing the message
string signer = 5 [ (gogoproto.moretags) = "yaml:\"signer\"" ];
Expand Down
Loading