fix_: filter private permissions & add Id keys in check_permissions_response (#5059)
This commit is contained in:
parent
3baaac3e63
commit
faf823f62f
|
@ -126,6 +126,7 @@ type PermissionTokenCriteriaResult struct {
|
|||
Role protobuf.CommunityTokenPermission_Type `json:"roles"`
|
||||
TokenRequirements []TokenRequirementResponse `json:"tokenRequirement"`
|
||||
Criteria []bool `json:"criteria"`
|
||||
ID string `json:"id"`
|
||||
}
|
||||
|
||||
type AccountChainIDsCombination struct {
|
||||
|
|
|
@ -410,6 +410,12 @@ func (p *DefaultPermissionChecker) CheckPermissions(permissions []*CommunityToke
|
|||
response.Permissions[tokenPermission.Id].TokenRequirements = append(response.Permissions[tokenPermission.Id].TokenRequirements, tokenRequirementResponse)
|
||||
response.Permissions[tokenPermission.Id].Criteria = append(response.Permissions[tokenPermission.Id].Criteria, tokenRequirementMet)
|
||||
}
|
||||
response.Permissions[tokenPermission.Id].ID = tokenPermission.Id
|
||||
|
||||
if tokenPermission.IsPrivate && !permissionRequirementsMet {
|
||||
delete(response.Permissions, tokenPermission.Id)
|
||||
}
|
||||
|
||||
// multiple permissions are treated as logical OR, meaning
|
||||
// if only one of them is fulfilled, the user gets permission
|
||||
// to join and we can stop early
|
||||
|
|
Loading…
Reference in New Issue