-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
591 changed files
with
9,428 additions
and
6,803 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
see issue: #XX | ||
closes: #XX | ||
|
||
### Visible/Frontend Changes | ||
- [x] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Extendability and Plugin Approach | ||
Aam Digital is designed to be an extendable platform. | ||
We try to define core interfaces that can be implemented in additional feature modules | ||
to implement further functionality in a modular way. | ||
|
||
The following aspects are specifically designed to be extended: | ||
- **DataTypes** | ||
- transformation functions how data is stored in / read from database | ||
- `editComponent` how data is displayed and edited in forms | ||
- `viewComponent` how data is displayed in tables | ||
- `importValueMapping` to support smart import into the data type | ||
- *also see [How to create a new Datatype](../how-to-guides/create-a-new-datatype.html)* | ||
- **Entity Types** | ||
- pre-define a data structure with various fields and custom logic that may be interconnected. This mostly is useful if you implement very specialized UI components for a specific data structure. | ||
- any entity type can be extended through config for individual clients (e.g. adding further properties at runtime) | ||
- demo data generator to automatically provide useful sample records | ||
- *also see [How to create a new Entity Type](../how-to-guides/create-a-new-entity-type.html)* | ||
- **Views** | ||
- defining a screen completely, including data loaded, etc. and hook it into the platforms navigation and overall layout | ||
- **Sub-Views** | ||
- defining a screen to display custom details for the entity currently loaded in the active route. The core platform takes care of passing the current entity and config details to the view as inputs. | ||
- **Dashboard Widgets** | ||
- filling the given card template with custom data and visualization | ||
- **Filters** | ||
- specialized logic and UIs to filter list data | ||
- **Technical "Backend" Implementations** | ||
- less common to change, but possible to implement integrations with different technical systems are | ||
- Authentication Services (e.g. switch between native CouchDB users and more advance Keycloak) | ||
- Database / Local Storage (e.g. switch between PouchDB using IndexedDB and purely in-memory, discardable data storage - or possibly implement an integration with a different system) | ||
|
||
The folder structure of the code base (while containing some intertwined legacy structures) also reflects this architecture: | ||
- *src/app/core*: generic structures and platform code | ||
- *src/app/features*: more specialized, modular features that plug into the core code (e.g. a location / map integration type) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Security | ||
|
||
We have made both technical and design choices to develop a secure platform. | ||
The Angular framework itself has some in-built protection against common security issues like cross-site scripting attacks (see [Angular > Security](https://angular.io/guide/security)). | ||
Beyond this, the following measures are implemented: | ||
|
||
- If deployed including our ["replication-backend"](https://github.com/Aam-Digital/replication-backend), that server-side API also ensures authenticated users can only access and sync data their account has permissions for. | ||
- Password policy enforces users to set a strong password including special characters (either via Keycloak or the platforms user profile form) | ||
- Content Security Policy (CSP) headers restrict connections to and execution of code from sources that are not whitelisted. | ||
|
||
## Content Security Policy (CSP) | ||
CSP headers are set in the nginx server being built from the code base to serve the Angular app. | ||
The whitelisted CSP sources can be overwritten and adapted using a docker environment variable `CSP` (the default whitelist is defined in the [Dockerfile](https://github.com/Aam-Digital/ndb-core/blob/master/build/Dockerfile)). | ||
|
||
> CSP is currently running in "report-only" mode for testing. | ||
> Scripts and connections are not yet blocked by default. | ||
### Allowing PouchDB to function under CSP | ||
The browser-side database system PouchDB uses map-reduce functions for indexing which are defined as strings. | ||
It is therefore requiring `'unsafe-eval'` in the CSP. | ||
|
||
### Whitelisting the index.html | ||
To whitelist a specific script section (currently only in the index.html) a [CSP hash](https://content-security-policy.com/hash/) can be used. | ||
Updating the hash should be necessary only rarely, when that script section changes. | ||
|
||
The easiest and most reliable way to get the correct hash is to deploy a production build image and check the browser console. | ||
It states something like `"Refused to execute inline script because it violates the following Content Security Policy directive: "...". Either the 'unsafe-inline' keyword, a hash ('sha256-<RELEVANT HASH>')" or a nonce is required."` from where you can copy the given hash and include/update it in the CSP headers. | ||
Generating the hash by pasting the script into an online generator does not seem to work, probably because code is minified during the build process. |
7 changes: 7 additions & 0 deletions
7
doc/compodoc_sources/how-to-guides/configure-custom-system.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Configure and Customize a System | ||
The platform allows very flexible customization of the user interface and data structures to different use cases. | ||
This is usually possible without changes to the code base, using the configuration system. | ||
|
||
> This guide is currently only a "stub". | ||
> | ||
> For the time being, please refer to the documentation about the [Configuration](../concepts/configuration.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# How to create a new Datatype | ||
"Datatypes" define how a single field (i.e. entity property) is stored and displayed. | ||
They are core building blocks for all entities and can enable advanced functionality, like displaying a streetmap for an address. | ||
|
||
The Aam Digital core defines most commonly known datatypes already (see `CoreModule`). | ||
The architecture of datatypes is designed for extension however, so you can easily add further types. | ||
|
||
## The base: `DefaultDatatype` and Angular Service | ||
`DefaultDatatype` is the base class for all implementations of custom datatypes. | ||
It implements default logic for all the required aspects so that you can override only those parts that are relevant for your new type. | ||
|
||
Implementations of datatypes are normal Angular Services. | ||
This allows you to inject and use any other service that you may need to do sophisticated data transformations. | ||
|
||
## Defining a new Datatype | ||
- Create a new Angular Service class (according to our file name convention it should follow the pattern `my-custom.datatype.ts`) | ||
- Use inheritance to extend the `DefaultDatatype` class | ||
- Define your datatype identifier (which is used in `@DatabaseField` annotations in their `EntitySchemaField` definitions) by setting the `static dataType = "my-custom"` property of your class | ||
- Override any of the other aspects if you want to customize them | ||
|
||
This could result in a Datatype class like this: | ||
``` | ||
@Injectable() | ||
export class MyCustomDatatype extends DefaultDatatype<SpecialObject, string> { | ||
static dataType = "my-custom"; | ||
constructor() { | ||
super(); | ||
// use constructor to simply inject other services you need | ||
} | ||
editComponent = "EditMyCustomFormField"; | ||
viewComponent = "DisplayText"; | ||
// make sure to register your new components in the ComponentRegistry | ||
transformToDatabaseFormat(value: SpecialObject): string { | ||
// storing as string in the database for whatever reason | ||
return value.toString(); | ||
} | ||
transformToObjectFormat(value: string): SpecialObject { | ||
return transformToSpecialObject(value); | ||
} | ||
importConfigComponent = "SpecialImportValueMapping"; | ||
importMapFunction(value: any, schemaField: EntitySchemaField, additional?: any) { | ||
return SpecialValueParserForDifferentImportFormats(value); | ||
} | ||
} | ||
``` | ||
|
||
Please also refer to the extensive JsDoc code comments in the `DefaultDatatype` class. | ||
|
||
## Registering the new Datatype | ||
Provide your datatype service using Angular dependency injection: | ||
`{ provide: DefaultDatatype, useClass: MyCustomDatatype, multi: true },` | ||
|
||
The EntitySchemaService, that handles all data transformations, and other platform modules automatically pick up your datatype | ||
and use it for any entity properties that use the `dataType` identifier of your implementation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.