mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 23:27:23 +00:00
fix: checkperms (#689)
* fix: read user grants as grant owner * fix: read user grants as grant owner
This commit is contained in:
parent
779879f6ae
commit
c92042ba47
@ -35,6 +35,8 @@ func translateError(ctx context.Context, err error, translator *i18n.Translator)
|
|||||||
caosErr := new(caos_errs.CaosError)
|
caosErr := new(caos_errs.CaosError)
|
||||||
if errors.As(err, &caosErr) {
|
if errors.As(err, &caosErr) {
|
||||||
caosErr.SetMessage(translator.LocalizeFromCtx(ctx, caosErr.GetMessage(), nil))
|
caosErr.SetMessage(translator.LocalizeFromCtx(ctx, caosErr.GetMessage(), nil))
|
||||||
|
} else {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
return caosErr
|
return caosErr
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ func (repo *UserGrantRepo) SearchUserGrants(ctx context.Context, request *grant_
|
|||||||
result = &grant_model.UserGrantSearchResponse{
|
result = &grant_model.UserGrantSearchResponse{
|
||||||
Offset: request.Offset,
|
Offset: request.Offset,
|
||||||
Limit: request.Limit,
|
Limit: request.Limit,
|
||||||
TotalResult: uint64(count),
|
TotalResult: count,
|
||||||
Result: model.UserGrantsToModel(grants),
|
Result: model.UserGrantsToModel(grants),
|
||||||
}
|
}
|
||||||
if sequenceErr == nil {
|
if sequenceErr == nil {
|
||||||
@ -153,6 +153,7 @@ func handleSearchUserGrantPermissions(ctx context.Context, request *grant_model.
|
|||||||
if result != nil {
|
if result != nil {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
if _, query := request.GetSearchQuery(grant_model.UserGrantSearchKeyProjectID); query != nil {
|
if _, query := request.GetSearchQuery(grant_model.UserGrantSearchKeyProjectID); query != nil {
|
||||||
result := checkContainsPermID(ids, query, request, sequence)
|
result := checkContainsPermID(ids, query, request, sequence)
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1148,10 +1148,10 @@ func (m *CreateMachineRequest) Validate() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if l := utf8.RuneCountInString(m.GetDescription()); l < 1 || l > 500 {
|
if utf8.RuneCountInString(m.GetDescription()) > 500 {
|
||||||
return CreateMachineRequestValidationError{
|
return CreateMachineRequestValidationError{
|
||||||
field: "Description",
|
field: "Description",
|
||||||
reason: "value length must be between 1 and 500 runes, inclusive",
|
reason: "value length must be at most 500 runes",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -797,7 +797,7 @@
|
|||||||
"200": {
|
"200": {
|
||||||
"description": "A successful response.",
|
"description": "A successful response.",
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object"
|
"$ref": "#/definitions/protobufStruct"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -854,6 +854,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
"protobufListValue": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"values": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/protobufValue"
|
||||||
|
},
|
||||||
|
"description": "Repeated field of dynamically typed values."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "`ListValue` is a wrapper around a repeated field of values.\n\nThe JSON representation for `ListValue` is JSON array."
|
||||||
|
},
|
||||||
"protobufNullValue": {
|
"protobufNullValue": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": [
|
||||||
@ -862,6 +875,51 @@
|
|||||||
"default": "NULL_VALUE",
|
"default": "NULL_VALUE",
|
||||||
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
|
"description": "`NullValue` is a singleton enumeration to represent the null value for the\n`Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n\n - NULL_VALUE: Null value."
|
||||||
},
|
},
|
||||||
|
"protobufStruct": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"fields": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"$ref": "#/definitions/protobufValue"
|
||||||
|
},
|
||||||
|
"description": "Unordered map of dynamically typed values."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "`Struct` represents a structured data value, consisting of fields\nwhich map to dynamically typed values. In some languages, `Struct`\nmight be supported by a native representation. For example, in\nscripting languages like JS a struct is represented as an\nobject. The details of that representation are described together\nwith the proto support for the language.\n\nThe JSON representation for `Struct` is JSON object."
|
||||||
|
},
|
||||||
|
"protobufValue": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"null_value": {
|
||||||
|
"$ref": "#/definitions/protobufNullValue",
|
||||||
|
"description": "Represents a null value."
|
||||||
|
},
|
||||||
|
"number_value": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double",
|
||||||
|
"description": "Represents a double value."
|
||||||
|
},
|
||||||
|
"string_value": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Represents a string value."
|
||||||
|
},
|
||||||
|
"bool_value": {
|
||||||
|
"type": "boolean",
|
||||||
|
"format": "boolean",
|
||||||
|
"description": "Represents a boolean value."
|
||||||
|
},
|
||||||
|
"struct_value": {
|
||||||
|
"$ref": "#/definitions/protobufStruct",
|
||||||
|
"description": "Represents a structured value."
|
||||||
|
},
|
||||||
|
"list_value": {
|
||||||
|
"$ref": "#/definitions/protobufListValue",
|
||||||
|
"description": "Represents a repeated `Value`."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "`Value` represents a dynamically typed value which can be either\nnull, a number, a string, a boolean, a recursive struct value, or a\nlist of values. A producer of value is expected to set one of that\nvariants, absence of any variant indicates an error.\n\nThe JSON representation for `Value` is JSON value."
|
||||||
|
},
|
||||||
"v1AddIamMemberRequest": {
|
"v1AddIamMemberRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -481,7 +481,7 @@ message CreateHumanRequest {
|
|||||||
|
|
||||||
message CreateMachineRequest {
|
message CreateMachineRequest {
|
||||||
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 200}];
|
||||||
string description = 2 [(validate.rules).string = {min_len: 1, max_len: 500}];
|
string description = 2 [(validate.rules).string = {max_len: 500}];
|
||||||
}
|
}
|
||||||
|
|
||||||
message UserResponse {
|
message UserResponse {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user