mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 07:47:32 +00:00
fix(console): remove cropper, set avatar url if available (#1865)
* set avatarurl if available * lint * force sidemargin * dont load image via asset * rm log * stylelint * add ZITADEL domain to csp img src * sanitize url * fix undefined link projects * use name as fallback * operator: rename uploadServiceURL to assetServiceURL in environment json for console * remove data * rm logs * center crop image * add avatar to changes Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -31,6 +31,7 @@ func UserChangeToPb(change *user_model.UserChange) *change_pb.Change {
|
||||
EditorId: change.ModifierID,
|
||||
EditorDisplayName: change.ModifierName,
|
||||
EditorPreferredLoginName: change.ModifierLoginName,
|
||||
EditorAvatarUrl: change.ModifierAvatarURL,
|
||||
// ResourceOwnerId: change.,TODO: resource owner not returned
|
||||
}
|
||||
}
|
||||
@@ -51,6 +52,7 @@ func OrgChangeToPb(change *org_model.OrgChange) *change_pb.Change {
|
||||
EditorId: change.ModifierId,
|
||||
EditorDisplayName: change.ModifierName,
|
||||
EditorPreferredLoginName: change.ModifierLoginName,
|
||||
EditorAvatarUrl: change.ModifierAvatarURL,
|
||||
// ResourceOwnerId: change.,TODO: resource owner not returned
|
||||
}
|
||||
}
|
||||
@@ -71,6 +73,7 @@ func ProjectChangeToPb(change *proj_model.ProjectChange) *change_pb.Change {
|
||||
EditorId: change.ModifierId,
|
||||
EditorDisplayName: change.ModifierName,
|
||||
EditorPreferredLoginName: change.ModifierLoginName,
|
||||
EditorAvatarUrl: change.ModifierAvatarURL,
|
||||
// ResourceOwnerId: change.,TODO: resource owner not returned
|
||||
}
|
||||
}
|
||||
@@ -91,6 +94,7 @@ func AppChangeToPb(change *proj_model.ApplicationChange) *change_pb.Change {
|
||||
EditorId: change.ModifierId,
|
||||
EditorDisplayName: change.ModifierName,
|
||||
EditorPreferredLoginName: change.ModifierLoginName,
|
||||
EditorAvatarUrl: change.ModifierAvatarURL,
|
||||
// ResourceOwnerId: change.,TODO: resource owner not returned
|
||||
}
|
||||
}
|
||||
|
@@ -4,18 +4,16 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/eventstore/v1"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
|
||||
"github.com/caos/zitadel/internal/config/systemdefaults"
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
|
||||
"github.com/caos/logging"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"github.com/caos/zitadel/internal/auth/repository/eventsourcing/view"
|
||||
"github.com/caos/zitadel/internal/config/systemdefaults"
|
||||
"github.com/caos/zitadel/internal/errors"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
key_model "github.com/caos/zitadel/internal/key/model"
|
||||
key_view_model "github.com/caos/zitadel/internal/key/repository/view/model"
|
||||
"github.com/caos/zitadel/internal/telemetry/tracing"
|
||||
"github.com/caos/zitadel/internal/user/model"
|
||||
@@ -206,6 +204,7 @@ func (repo *UserRepo) MyUserChanges(ctx context.Context, lastSequence uint64, li
|
||||
change.ModifierLoginName = user.PreferredLoginName
|
||||
if user.HumanView != nil {
|
||||
change.ModifierName = user.HumanView.DisplayName
|
||||
change.ModifierAvatarURL = user.HumanView.AvatarURL
|
||||
}
|
||||
if user.MachineView != nil {
|
||||
change.ModifierName = user.MachineView.Name
|
||||
|
@@ -108,6 +108,7 @@ func (repo *OrgRepository) OrgChanges(ctx context.Context, id string, lastSequen
|
||||
change.ModifierLoginName = user.PreferredLoginName
|
||||
if user.HumanView != nil {
|
||||
change.ModifierName = user.HumanView.DisplayName
|
||||
change.ModifierAvatarURL = user.HumanView.AvatarURL
|
||||
}
|
||||
if user.MachineView != nil {
|
||||
change.ModifierName = user.MachineView.Name
|
||||
|
@@ -203,6 +203,7 @@ func (repo *ProjectRepo) ProjectChanges(ctx context.Context, id string, lastSequ
|
||||
change.ModifierLoginName = user.PreferredLoginName
|
||||
if user.HumanView != nil {
|
||||
change.ModifierName = user.HumanView.DisplayName
|
||||
change.ModifierAvatarURL = user.HumanView.AvatarURL
|
||||
}
|
||||
if user.MachineView != nil {
|
||||
change.ModifierName = user.MachineView.Name
|
||||
@@ -282,6 +283,7 @@ func (repo *ProjectRepo) ApplicationChanges(ctx context.Context, projectID strin
|
||||
change.ModifierLoginName = user.PreferredLoginName
|
||||
if user.HumanView != nil {
|
||||
change.ModifierName = user.HumanView.DisplayName
|
||||
change.ModifierAvatarURL = user.HumanView.AvatarURL
|
||||
}
|
||||
if user.MachineView != nil {
|
||||
change.ModifierName = user.MachineView.Name
|
||||
|
@@ -105,6 +105,7 @@ func (repo *UserRepo) UserChanges(ctx context.Context, id string, lastSequence u
|
||||
change.ModifierLoginName = user.PreferredLoginName
|
||||
if user.HumanView != nil {
|
||||
change.ModifierName = user.HumanView.DisplayName
|
||||
change.ModifierAvatarURL = user.HumanView.AvatarURL
|
||||
}
|
||||
if user.MachineView != nil {
|
||||
change.ModifierName = user.MachineView.Name
|
||||
|
@@ -40,6 +40,7 @@ type OrgChange struct {
|
||||
ModifierId string `json:"modifierUser,omitempty"`
|
||||
ModifierName string `json:"-"`
|
||||
ModifierLoginName string `json:"-"`
|
||||
ModifierAvatarURL string `json:"-"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
|
@@ -28,6 +28,7 @@ type ApplicationChange struct {
|
||||
ModifierId string `json:"modifierUser,omitempty"`
|
||||
ModifierName string `json:"-"`
|
||||
ModifierLoginName string `json:"-"`
|
||||
ModifierAvatarURL string `json:"-"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,7 @@ type ProjectChange struct {
|
||||
ModifierId string `json:"modifierUser,omitempty"`
|
||||
ModifierName string `json:"-"`
|
||||
ModifierLoginName string `json:"-"`
|
||||
ModifierAvatarURL string `json:"-"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,7 @@ func csp(zitadelDomain string) *middleware.CSP {
|
||||
AddHost("fonts.googleapis.com").
|
||||
AddHost("fonts.gstatic.com").
|
||||
AddHost("maxst.icons8.com") //TODO: host it
|
||||
csp.ImgSrc = csp.ImgSrc.AddScheme("blob")
|
||||
csp.ImgSrc = csp.ImgSrc.AddHost(zitadelDomain).AddScheme("blob")
|
||||
return &csp
|
||||
}
|
||||
|
||||
|
@@ -16,5 +16,6 @@ type UserChange struct {
|
||||
ModifierID string `json:"modifierUser,omitempty"`
|
||||
ModifierName string `json:"-"`
|
||||
ModifierLoginName string `json:"-"`
|
||||
ModifierAvatarURL string `json:"-"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user