fix: label policy fixes (#1886)

* fix: check correct permission for label policy in console policy grid

* fix: add next steps for label policy detail

* fix: add label policy link in console home

* fix: i18n of EN features

* fix: set font color on preview

* fix: handle label policy remove in write model

* fix: add more content-types for font upload

* fix: add label policy link in console home

* fix: dont return error when bucket does not exists

* fix: iam access pref

* fix: EN i18n for apply button
This commit is contained in:
Livio Amstutz 2021-06-17 14:10:14 +02:00 committed by GitHub
parent 82ae9dd459
commit 32f8545082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 24 deletions

View File

@ -3,14 +3,14 @@
<div class="dashed" [ngClass]="{'dark': theme === Theme.DARK, 'light': theme === Theme.LIGHT}" [style.background]="theme == Theme.DARK ? policy.backgroundColorDark : policy.backgroundColor">
<div class="login-wrapper" [style.color]="theme == Theme.DARK ? policy.fontColorDark : policy.fontColor">
<img *ngIf="images['previewLogo'] && theme == Theme.LIGHT" [src]="images['previewLogo']" alt="logo-mock" />
<img *ngIf="images['previewDarkLogo'] && theme == Theme.DARK" [src]="images['previewDarkLogo']" alt="logo-mock" />
<h1>{{'POLICY.PRIVATELABELING.PREVIEW.TITLE' | translate}}</h1>
<p class="desc-text">{{'POLICY.PRIVATELABELING.PREVIEW.SECOND' | translate}}</p>
<h1 [style.color]="theme == Theme.DARK ? policy.fontColorDark : policy.fontColor">{{'POLICY.PRIVATELABELING.PREVIEW.TITLE' | translate}}</h1>
<p [style.color]="theme == Theme.DARK ? policy.fontColorDark : policy.fontColor" class="desc-text">{{'POLICY.PRIVATELABELING.PREVIEW.SECOND' | translate}}</p>
<cnsl-form-field class="formfield">
<cnsl-label>Loginname</cnsl-label>
<input cnslInput value="road.runner"/>
<input cnslInput [style.color]="theme == Theme.DARK ? policy.fontColorDark : policy.fontColor" value="road.runner"/>
</cnsl-form-field>
<div class="error-msg" [style.color]="theme == Theme.DARK ? policy.warnColorDark : policy.warnColor">
@ -19,10 +19,10 @@
</div>
<div class="btn-wrapper">
<button mat-stroked-button>{{'POLICY.PRIVATELABELING.PREVIEW.SECONDARYBUTTON' | translate}}</button>
<button mat-stroked-button [style.color]="theme == Theme.DARK ? policy.fontColorDark : policy.fontColor">{{'POLICY.PRIVATELABELING.PREVIEW.SECONDARYBUTTON' | translate}}</button>
<button *ngIf="theme == Theme.DARK" mat-raised-button [style.background]="policy.primaryColorDark" [style.color]="policy.primaryColorDark == '#ffffff' ? '#000000' : '#ffffff'">{{'POLICY.PRIVATELABELING.PREVIEW.PRIMARYBUTTON' | translate}}</button>
<button *ngIf="theme == Theme.LIGHT" mat-raised-button [style.background]="policy.primaryColor" [style.color]="policy.primaryColor == '#ffffff' ? '#000000' : '#ffffff'">{{'POLICY.PRIVATELABELING.PREVIEW.PRIMARYBUTTON' | translate}}</button>
</div>
</div>
</div>
</div>
</div>

View File

@ -25,7 +25,14 @@ import { StorageService } from 'src/app/services/storage.service';
import { ToastService } from 'src/app/services/toast.service';
import { CnslLinks } from '../../links/links.component';
import { IAM_COMPLEXITY_LINK, IAM_LOGIN_POLICY_LINK, IAM_POLICY_LINK } from '../../policy-grid/policy-links';
import {
IAM_COMPLEXITY_LINK,
IAM_LOGIN_POLICY_LINK,
IAM_POLICY_LINK,
ORG_COMPLEXITY_LINK,
ORG_IAM_POLICY_LINK,
ORG_LOGIN_POLICY_LINK,
} from '../../policy-grid/policy-links';
import { PolicyComponentServiceType } from '../policy-component-types.enum';
export enum Theme {
@ -114,9 +121,19 @@ export class PrivateLabelingPolicyComponent implements OnDestroy {
switch (this.serviceType) {
case PolicyComponentServiceType.MGMT:
this.service = this.injector.get(ManagementService as Type<ManagementService>);
this.nextLinks = [
ORG_IAM_POLICY_LINK,
ORG_LOGIN_POLICY_LINK,
ORG_COMPLEXITY_LINK,
];
break;
case PolicyComponentServiceType.ADMIN:
this.service = this.injector.get(AdminService as Type<AdminService>);
this.nextLinks = [
IAM_POLICY_LINK,
IAM_LOGIN_POLICY_LINK,
IAM_COMPLEXITY_LINK,
];
break;
}

View File

@ -56,18 +56,11 @@
<p class="desc">
{{'POLICY.IAM_POLICY.DESCRIPTION' | translate}}</p>
<cnsl-info-section class="warn"
*ngIf="type == PolicyGridType.ORG && (['password_complexity_policy'] | hasFeature | async) == false"
type="WARN">
{{'FEATURES.NOTAVAILABLE' | translate: ({value:
'password_complexity_policy'})}}
</cnsl-info-section>
<span class="fill-space"></span>
<div class="btn-wrapper">
<ng-template appHasRole [appHasRole]="['iam.policy.write']">
<button
[disabled]="type == PolicyGridType.ORG && (['password_complexity_policy'] | hasFeature | async) == false"
[routerLink]="[type == PolicyGridType.IAM ? '/iam' : type == PolicyGridType.ORG ? '/org' : '','policy', PolicyComponentType.IAM ]"
mat-stroked-button>{{'POLICY.BTN_EDIT' | translate}}</button>
</ng-template>
@ -75,7 +68,7 @@
</div>
</ng-template>
<ng-template appHasRole [appHasRole]="['iam.policy.read']">
<ng-template appHasRole [appHasRole]="type == PolicyGridType.IAM ? ['iam.policy.read'] : type == PolicyGridType.ORG ? ['policy.read'] : []">
<div class="p-item card">
<div class="avatar">
<i class="icon las la-gem"></i>
@ -98,7 +91,7 @@
<span class="fill-space"></span>
<div class="btn-wrapper">
<ng-template appHasRole [appHasRole]="['iam.policy.write']">
<ng-template appHasRole [appHasRole]="type == PolicyGridType.IAM ? ['iam.policy.write'] : type == PolicyGridType.ORG ? ['policy.write'] : []">
<button
[routerLink]="[type == PolicyGridType.IAM ? '/iam' : type == PolicyGridType.ORG ? '/org' : '','policy', PolicyComponentType.PRIVATELABEL ]"
mat-stroked-button>{{'POLICY.BTN_EDIT' | translate}}</button>
@ -133,4 +126,4 @@
</div>
</div>
</ng-template>
</div>
</div>

View File

@ -72,6 +72,8 @@
| translate}}<i class="las la-link"></i></a>
<a class="short-link" [routerLink]="[ '/iam', 'policy','login']">{{'HOME.IAM_POLICY_LOGIN' |
translate}}<i class="las la-link"></i></a>
<a class="short-link" [routerLink]="[ '/iam', 'policy','privatelabel']">{{'HOME.IAM_POLICY_LABEL' |
translate}}<i class="las la-link"></i></a>
</ng-template>
<span class="fill-space"></span>
@ -134,6 +136,8 @@
translate}}<i class="las la-link"></i></a>
<a class="short-link" [routerLink]="[ '/org', 'policy','login']">{{'HOME.ORG_POLICY_LOGIN' |
translate}}<i class="las la-link"></i></a>
<a class="short-link" [routerLink]="[ '/org', 'policy','privatelabel']">{{'HOME.ORG_POLICY_LABEL' |
translate}}<i class="las la-link"></i></a>
</ng-template>
</div>
<span class="fill-space"></span>
@ -176,4 +180,4 @@
<!-- TODO: Add doc link to security here -->
<!-- <a href="https://caos.github.io/site#security"></a> -->
</p>
</div>
</div>

View File

@ -46,9 +46,11 @@
"ORG_POLICY_COMPLEXITY": "Passwort Komplexität",
"ORG_POLICY_IAM": "Organisation Zugangseinstellungen",
"ORG_POLICY_LOGIN": "Login Richtlinie",
"ORG_POLICY_LABEL": "Private Label Richtlinie",
"IAM_POLICY_COMPLEXITY": "Systemweite Passwort Komplexität",
"IAM_POLICY_IAM": "Systemweite Zugangseinstellungen",
"IAN_POLICY_LOGIN": "Systemweite Login Richtlinie",
"IAN_POLICY_LABEL": "Systemweite Private Label Richtlinie",
"USERS": "Erstelle und verwalte Deine Benutzer.",
"USERS_DESC": "Überwache Dein Rollenkonzept in Echtzeit. Ergreife sofort Massnahmen.",
"USERS_HUMANS": "Zeige Benutzer",

View File

@ -45,10 +45,12 @@
"ORG_POLICY_COMPLEXITY": "Password Complexity Settings",
"ORG_POLICY_IAM": "Organisation Access Properties",
"ORG_POLICY_LOGIN": "Login Policy",
"ORG_POLICY_LABEL": "Private Label Policy",
"IAM_CREATE_ORG": "Create organisation",
"IAM_POLICY_COMPLEXITY": "System Password Complexity Settings",
"IAM_POLICY_IAM": "System Access Properties",
"IAM_POLICY_LOGIN": "System Login Policy",
"IAM_POLICY_LABEL": "System Private Label Policy",
"USERS": "Create and Manage Your Users",
"USERS_DESC": "Monitor your role concept in real time. Take immediate action.",
"USERS_HUMANS": "Show human users",
@ -623,8 +625,8 @@
"LOGINPOLICYFACTORS": "Login Policy: Multifactors - custom",
"LOGINPOLICYPASSWORDLESS": "Login Policy: Passwordless Authentication - custom",
"LOGINPOLICYCOMPLEXITYPOLICY": "Password Complexity Policy - custom",
"LABELPOLICYPRIVATELABEL": "Label Richtlinie - benutzerdefiniert",
"LABELPOLICYWATERMARK": "Label Richtlinie - Wasserzeichen",
"LABELPOLICYPRIVATELABEL": "Label Policy - custom",
"LABELPOLICYWATERMARK": "Label Policy - watermark",
"CUSTOMDOMAIN": "Domain Verification - available",
"CUSTOMTEXT": "Custom texts"
},
@ -653,7 +655,7 @@
"DESCRIPTION":"Give the login your personalized style and modify its behavior.",
"PREVIEW_DESCRIPTION":"Changes of the policy will automatically deployed to preview environment.",
"BTN":"Select File",
"ACTIVATEPREVIEW":"Set preview as current configuration",
"ACTIVATEPREVIEW":"Apply configuration",
"DARK":"Dark Mode",
"LIGHT":"Lighg Mode",
"CHANGEVIEW":"Change View",

View File

@ -268,11 +268,11 @@ func (l *labelPolicyIconDownloader) BucketName(ctx context.Context, id string) s
}
func (h *Handler) UploadDefaultLabelPolicyFont() Uploader {
return &labelPolicyFontUploader{h.idGenerator, true, []string{"font/"}, 1 << 19}
return &labelPolicyFontUploader{h.idGenerator, true, []string{"font/", "application/octet-stream"}, 1 << 19}
}
func (h *Handler) UploadOrgLabelPolicyFont() Uploader {
return &labelPolicyFontUploader{h.idGenerator, false, []string{"font/"}, 1 << 19}
return &labelPolicyFontUploader{h.idGenerator, false, []string{"font/", "application/octet-stream"}, 1 << 19}
}
type labelPolicyFontUploader struct {

View File

@ -30,6 +30,8 @@ func (wm *OrgLabelPolicyWriteModel) AppendEvents(events ...eventstore.EventReade
wm.LabelPolicyWriteModel.AppendEvents(&e.LabelPolicyAddedEvent)
case *org.LabelPolicyChangedEvent:
wm.LabelPolicyWriteModel.AppendEvents(&e.LabelPolicyChangedEvent)
case *org.LabelPolicyRemovedEvent:
wm.LabelPolicyWriteModel.AppendEvents(&e.LabelPolicyRemovedEvent)
case *org.LabelPolicyLogoAddedEvent:
wm.LabelPolicyWriteModel.AppendEvents(&e.LabelPolicyLogoAddedEvent)
case *org.LabelPolicyLogoRemovedEvent:
@ -65,6 +67,7 @@ func (wm *OrgLabelPolicyWriteModel) Query() *eventstore.SearchQueryBuilder {
EventTypes(
org.LabelPolicyAddedEventType,
org.LabelPolicyChangedEventType,
org.LabelPolicyRemovedEventType,
org.LabelPolicyLogoAddedEventType,
org.LabelPolicyLogoRemovedEventType,
org.LabelPolicyIconAddedEventType,

View File

@ -162,8 +162,12 @@ func (m *Minio) RemoveObjects(ctx context.Context, bucketName, path string, recu
defer close(objectsCh)
objects, cancel := m.listObjects(ctx, bucketName, path, recursive)
for object := range objects {
if object.Err != nil {
if err := object.Err; err != nil {
cancel()
if errResp := minio.ToErrorResponse(err); errResp.StatusCode == http.StatusNotFound {
logging.LogWithFields("MINIO-ss8va", "bucketName", bucketName, "path", path).Warn("list objects for remove failed with not found")
continue
}
return caos_errs.ThrowInternal(object.Err, "MINIO-WQF32", "Errors.Assets.Object.ListFailed")
}
objectsCh <- object