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
9 changed files with 13403 additions and 14017 deletions
@@ -162,6 +162,7 @@ func (u *UserGrant) fillUserData(grant *view_model.UserGrantView, user *usr_mode
grant.UserName = user.UserName grant.UserName = user.UserName
grant.FirstName = user.FirstName grant.FirstName = user.FirstName
grant.LastName = user.LastName grant.LastName = user.LastName
grant.DispalyName = user.DisplayName
grant.Email = user.EmailAddress grant.Email = user.EmailAddress
} }
+3 -1
View File
@@ -1,8 +1,9 @@
package model package model
import ( import (
"github.com/caos/zitadel/internal/model"
"time" "time"
"github.com/caos/zitadel/internal/model"
) )
type UserGrantView struct { type UserGrantView struct {
@@ -13,6 +14,7 @@ type UserGrantView struct {
UserName string UserName string
FirstName string FirstName string
LastName string LastName string
DisplayName string
Email string Email string
ProjectName string ProjectName string
OrgName string OrgName string
@@ -30,6 +30,7 @@ type UserGrantView struct {
UserName string `json:"-" gorm:"column:user_name"` UserName string `json:"-" gorm:"column:user_name"`
FirstName string `json:"-" gorm:"column:first_name"` FirstName string `json:"-" gorm:"column:first_name"`
LastName string `json:"-" gorm:"column:last_name"` LastName string `json:"-" gorm:"column:last_name"`
DispalyName string `json:"-" grom:"column:display_name"`
Email string `json:"-" gorm:"column:email"` Email string `json:"-" gorm:"column:email"`
ProjectName string `json:"-" gorm:"column:project_name"` ProjectName string `json:"-" gorm:"column:project_name"`
OrgName string `json:"-" gorm:"column:org_name"` OrgName string `json:"-" gorm:"column:org_name"`
@@ -54,6 +55,7 @@ func UserGrantFromModel(grant *model.UserGrantView) *UserGrantView {
UserName: grant.UserName, UserName: grant.UserName,
FirstName: grant.FirstName, FirstName: grant.FirstName,
LastName: grant.LastName, LastName: grant.LastName,
DispalyName: grant.DisplayName,
Email: grant.Email, Email: grant.Email,
ProjectName: grant.ProjectName, ProjectName: grant.ProjectName,
OrgName: grant.OrgName, OrgName: grant.OrgName,
@@ -74,6 +76,7 @@ func UserGrantToModel(grant *UserGrantView) *model.UserGrantView {
UserName: grant.UserName, UserName: grant.UserName,
FirstName: grant.FirstName, FirstName: grant.FirstName,
LastName: grant.LastName, LastName: grant.LastName,
DisplayName: grant.DispalyName,
Email: grant.Email, Email: grant.Email,
ProjectName: grant.ProjectName, ProjectName: grant.ProjectName,
OrgName: grant.OrgName, OrgName: grant.OrgName,
@@ -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
@@ -3548,7 +3548,7 @@
"200": { "200": {
"description": "A successful response.", "description": "A successful response.",
"schema": { "schema": {
"$ref": "#/definitions/protobufStruct" "type": "object"
} }
} }
}, },
@@ -3559,19 +3559,6 @@
} }
}, },
"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": [
@@ -3580,51 +3567,6 @@
"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."
},
"v1AddOrgDomainRequest": { "v1AddOrgDomainRequest": {
"type": "object", "type": "object",
"properties": { "properties": {
@@ -3827,7 +3769,7 @@
"type": "string" "type": "string"
}, },
"data": { "data": {
"$ref": "#/definitions/protobufStruct" "type": "object"
} }
} }
}, },
@@ -6401,6 +6343,9 @@
}, },
"resource_owner": { "resource_owner": {
"type": "string" "type": "string"
},
"display_name": {
"type": "string"
} }
} }
}, },
@@ -166,6 +166,10 @@ func userGrantViewFromModel(grant *grant_model.UserGrantView) *UserGrantView {
OrgName: grant.OrgName, OrgName: grant.OrgName,
OrgDomain: grant.OrgDomain, OrgDomain: grant.OrgDomain,
RoleKeys: grant.RoleKeys, RoleKeys: grant.RoleKeys,
UserId: grant.UserID,
ProjectId: grant.ProjectID,
OrgId: grant.ResourceOwner,
DisplayName: grant.DisplayName,
} }
} }
@@ -2554,6 +2554,7 @@ message UserGrantView {
string project_name = 15; string project_name = 15;
uint64 sequence = 16; uint64 sequence = 16;
string resource_owner = 17; string resource_owner = 17;
string display_name = 18;
} }