fix(management): map all fields in user grant view converter (#324)

* fix(management): map all fields in user grant view converter

* feat(management): add display name to user grant view
This commit is contained in:
Silvan 2020-07-01 12:46:46 +02:00 committed by GitHub
parent cf7a906023
commit f57913fdcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 13403 additions and 14017 deletions

View File

@ -162,6 +162,7 @@ func (u *UserGrant) fillUserData(grant *view_model.UserGrantView, user *usr_mode
grant.UserName = user.UserName
grant.FirstName = user.FirstName
grant.LastName = user.LastName
grant.DispalyName = user.DisplayName
grant.Email = user.EmailAddress
}

View File

@ -1,8 +1,9 @@
package model
import (
"github.com/caos/zitadel/internal/model"
"time"
"github.com/caos/zitadel/internal/model"
)
type UserGrantView struct {
@ -13,6 +14,7 @@ type UserGrantView struct {
UserName string
FirstName string
LastName string
DisplayName string
Email string
ProjectName string
OrgName string

View File

@ -30,6 +30,7 @@ type UserGrantView struct {
UserName string `json:"-" gorm:"column:user_name"`
FirstName string `json:"-" gorm:"column:first_name"`
LastName string `json:"-" gorm:"column:last_name"`
DispalyName string `json:"-" grom:"column:display_name"`
Email string `json:"-" gorm:"column:email"`
ProjectName string `json:"-" gorm:"column:project_name"`
OrgName string `json:"-" gorm:"column:org_name"`
@ -54,6 +55,7 @@ func UserGrantFromModel(grant *model.UserGrantView) *UserGrantView {
UserName: grant.UserName,
FirstName: grant.FirstName,
LastName: grant.LastName,
DispalyName: grant.DisplayName,
Email: grant.Email,
ProjectName: grant.ProjectName,
OrgName: grant.OrgName,
@ -74,6 +76,7 @@ func UserGrantToModel(grant *UserGrantView) *model.UserGrantView {
UserName: grant.UserName,
FirstName: grant.FirstName,
LastName: grant.LastName,
DisplayName: grant.DispalyName,
Email: grant.Email,
ProjectName: grant.ProjectName,
OrgName: grant.OrgName,

View File

@ -0,0 +1 @@
ALTER TABLE management.user_grants ADD COLUMN display_name TEXT;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3548,7 +3548,7 @@
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/protobufStruct"
"type": "object"
}
}
},
@ -3559,19 +3559,6 @@
}
},
"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": {
"type": "string",
"enum": [
@ -3580,51 +3567,6 @@
"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."
},
"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."
},
"v1AddOrgDomainRequest": {
"type": "object",
"properties": {
@ -3827,7 +3769,7 @@
"type": "string"
},
"data": {
"$ref": "#/definitions/protobufStruct"
"type": "object"
}
}
},
@ -6401,6 +6343,9 @@
},
"resource_owner": {
"type": "string"
},
"display_name": {
"type": "string"
}
}
},

View File

@ -166,6 +166,10 @@ func userGrantViewFromModel(grant *grant_model.UserGrantView) *UserGrantView {
OrgName: grant.OrgName,
OrgDomain: grant.OrgDomain,
RoleKeys: grant.RoleKeys,
UserId: grant.UserID,
ProjectId: grant.ProjectID,
OrgId: grant.ResourceOwner,
DisplayName: grant.DisplayName,
}
}

View File

@ -2554,6 +2554,7 @@ message UserGrantView {
string project_name = 15;
uint64 sequence = 16;
string resource_owner = 17;
string display_name = 18;
}