SCOPE CHECK DISABLED
diff --git a/projects/app/workbench-application-platform/dev-tools-app/src/app/dev-tools/application-view/application-view.component.scss b/projects/app/workbench-application-platform/dev-tools-app/src/app/dev-tools/application-view/application-view.component.scss
index ddca98d85..ada52aa9f 100644
--- a/projects/app/workbench-application-platform/dev-tools-app/src/app/dev-tools/application-view/application-view.component.scss
+++ b/projects/app/workbench-application-platform/dev-tools-app/src/app/dev-tools/application-view/application-view.component.scss
@@ -21,47 +21,47 @@
> label.app-name {
grid-column: 1/2;
- grid-row: 1/2;
}
> span.app-name {
grid-column: 2/3;
- grid-row: 1/2;
}
> label.app-symbolic-name {
grid-column: 1/2;
- grid-row: 2/3;
}
> span.app-symbolic-name {
grid-column: 2/3;
- grid-row: 2/3;
}
> label.app-url {
grid-column: 1/2;
- grid-row: 3/4;
}
> a.app-url {
grid-column: 2/3;
- grid-row: 3/4;
}
> label.manifest-url {
grid-column: 1/2;
- grid-row: 4/5;
}
> a.manifest-url {
grid-column: 2/3;
- grid-row: 4/5;
+ }
+
+ > label.restrictions {
+ grid-column: 1/2;
+ }
+
+ > sci-property.restrictions {
+ grid-column: 2/3;
}
> span.scope-check-disabled {
grid-column: 3/4;
- grid-row: 1/5;
+ grid-row: 1/6;
align-self: start;
justify-self: end;
font-weight: bold;
diff --git a/projects/scion/workbench-application-platform.api/src/lib/core.model.ts b/projects/scion/workbench-application-platform.api/src/lib/core.model.ts
index ce0ba1997..6c0201294 100644
--- a/projects/scion/workbench-application-platform.api/src/lib/core.model.ts
+++ b/projects/scion/workbench-application-platform.api/src/lib/core.model.ts
@@ -85,6 +85,17 @@ export interface Application {
* By default, scope check is enabled, and should only be enabled for system applications like `DevTools`.
*/
scopeCheckDisabled: boolean;
+ /**
+ * Defines restrictions for this application, e.g. to not contribute activities.
+ *
+ * By default, the app has no restrictions.
+ */
+ restrictions?: {
+ /**
+ * Controls if this application is allowed to contribute activities.
+ */
+ activityContributionAllowed: boolean;
+ };
}
/**
diff --git a/projects/scion/workbench-application-platform.api/src/lib/manifest-registry.model.ts b/projects/scion/workbench-application-platform.api/src/lib/manifest-registry.model.ts
index fabcdc77b..d692baf6c 100644
--- a/projects/scion/workbench-application-platform.api/src/lib/manifest-registry.model.ts
+++ b/projects/scion/workbench-application-platform.api/src/lib/manifest-registry.model.ts
@@ -124,4 +124,8 @@ export interface Manifest {
* Indicates whether or not capability scope check is disabled for this application.
*/
scopeCheckDisabled: boolean;
+ /**
+ * Defines restrictions for this application.
+ */
+ restrictions: any;
}
diff --git a/projects/scion/workbench-application-platform/src/lib/core/application-registry.service.ts b/projects/scion/workbench-application-platform/src/lib/core/application-registry.service.ts
index a300e0c94..aaa4148c1 100644
--- a/projects/scion/workbench-application-platform/src/lib/core/application-registry.service.ts
+++ b/projects/scion/workbench-application-platform/src/lib/core/application-registry.service.ts
@@ -12,7 +12,7 @@ import { Injectable } from '@angular/core';
import { ApplicationConfig, ApplicationManifest, HOST_APPLICATION_SYMBOLIC_NAME } from './metadata';
import { Defined } from './defined.util';
import { ManifestRegistry } from './manifest-registry.service';
-import { Application } from '@scion/workbench-application-platform.api';
+import { Application, Capability, PlatformCapabilityTypes } from '@scion/workbench-application-platform.api';
import { Url } from './url.util';
/**
@@ -52,20 +52,43 @@ export class ApplicationRegistry {
throw Error(`[ApplicationRegistrationError] Symbolic name must be unique [symbolicName='${applicationConfig.symbolicName}'].`);
}
- const scopeCheckDisabled = applicationConfig.scopeCheckDisabled || false;
+ const scopeCheckDisabled = Defined.orElse(applicationConfig.scopeCheckDisabled, false);
+
this._applications.set(applicationConfig.symbolicName, {
symbolicName: applicationConfig.symbolicName,
name: manifest.name,
baseUrl: this.computeBaseUrl(applicationConfig, manifest),
manifestUrl: new URL(applicationConfig.manifestUrl, Url.isAbsoluteUrl(applicationConfig.manifestUrl) ? applicationConfig.manifestUrl : window.origin).toString(),
scopeCheckDisabled: scopeCheckDisabled,
+ restrictions: applicationConfig.restrictions,
});
- this._manifestRegistry.registerCapability(applicationConfig.symbolicName, manifest.capabilities);
+ this._manifestRegistry.registerCapability(applicationConfig.symbolicName, this.filterCapabilities(manifest.capabilities, applicationConfig));
this._manifestRegistry.registerIntents(applicationConfig.symbolicName, manifest.intents);
scopeCheckDisabled && this._manifestRegistry.disableScopeChecks(applicationConfig.symbolicName);
}
+ /**
+ * Filters capabilities which given application is not allowed to provide.
+ */
+ private filterCapabilities(capabilities: Capability[], applicationConfig: ApplicationConfig): Capability[] {
+ const restrictions = applicationConfig.restrictions;
+ const activityContributionAllowed = Defined.orElse(restrictions && restrictions.activityContributionAllowed, true);
+
+ if (!activityContributionAllowed) {
+ return capabilities
+ .filter(capability => capability.type !== PlatformCapabilityTypes.Activity)
+ .map(capability => {
+ if (capability.type === PlatformCapabilityTypes.View) {
+ return ({...capability, properties: {...capability.properties, activityItem: null}});
+ }
+ return capability;
+ });
+ }
+
+ return capabilities;
+ }
+
public getApplication(symbolicName: string): Application {
return this._applications.get(symbolicName);
}
diff --git a/projects/scion/workbench-application-platform/src/lib/core/metadata.ts b/projects/scion/workbench-application-platform/src/lib/core/metadata.ts
index cde579e98..297ff3e09 100644
--- a/projects/scion/workbench-application-platform/src/lib/core/metadata.ts
+++ b/projects/scion/workbench-application-platform/src/lib/core/metadata.ts
@@ -51,6 +51,17 @@ export interface ApplicationConfig {
* By default, scope check is enabled.
*/
scopeCheckDisabled?: boolean;
+ /**
+ * Defines restrictions for this application, e.g. to not contribute activities.
+ *
+ * By default, the app has no restrictions.
+ */
+ restrictions?: {
+ /**
+ * Controls if this application is allowed to contribute activities.
+ */
+ activityContributionAllowed: boolean;
+ };
}
/**
diff --git a/projects/scion/workbench-application-platform/src/lib/manifest-capability/manifest-registry-intent-handler.service.ts b/projects/scion/workbench-application-platform/src/lib/manifest-capability/manifest-registry-intent-handler.service.ts
index 4f3b0f013..70d391c5f 100644
--- a/projects/scion/workbench-application-platform/src/lib/manifest-capability/manifest-registry-intent-handler.service.ts
+++ b/projects/scion/workbench-application-platform/src/lib/manifest-capability/manifest-registry-intent-handler.service.ts
@@ -150,6 +150,7 @@ export class ManifestRegistryIntentHandler implements IntentHandler {
baseUrl: application.baseUrl,
manifestUrl: application.manifestUrl,
scopeCheckDisabled: application.scopeCheckDisabled,
+ restrictions: application.restrictions,
intents: this._manifestRegistry.getIntentsByApplication(application.symbolicName),
capabilities: this._manifestRegistry.getCapabilitiesByApplication(application.symbolicName)
.filter(capability => !capability.metadata.proxy),
diff --git a/resources/site/how-to/workbench-application-platform/how-to-register-applications.md b/resources/site/how-to/workbench-application-platform/how-to-register-applications.md
index cf287967b..f7c0f2768 100644
--- a/resources/site/how-to/workbench-application-platform/how-to-register-applications.md
+++ b/resources/site/how-to/workbench-application-platform/how-to-register-applications.md
@@ -14,6 +14,7 @@ Following properties are supported:
|manifestUrl|string|✓|URL to the application manifest.|
|exclude|boolean||Excludes the application from registration, e.g. to not register it in a specific environment.|
|scopeCheckDisabled|boolean||Sets whether or not capability scope check is disabled for this application.With scope check disabled (discouraged), the application can invoke private capabilities of other applications.
By default, scope check is enabled.|
+|restrictions|{activityContributionAllowed: boolean}||Defines restrictions for this application, e.g. to not contribute activities.
By default, the app has no restrictions.|
### Static application registration