Merge branch 'master' of github.com:ReCodEx/GlobalWiki.wiki

master
Teyras 8 years ago
commit 4c1fb87934

@ -0,0 +1,3 @@
# Database schema
![Database schema](https://rawgit.com/ReCodEx/wiki/master/images/recodex-db.svg)

@ -58,6 +58,7 @@
* [[FAQ]] * [[FAQ]]
* [[Logo]] * [[Logo]]
* [[Coding style]] * [[Coding style]]
* [[Database schema]]
## Documentation ## Documentation
* [API documentation](http://recodex.github.io/api-doc) * [API documentation](http://recodex.github.io/api-doc)

@ -10,7 +10,7 @@ goes as HTTP(S) requests in predefined format, nowadays mostly known as
Results from the API are in plain text in JSON format to be easily parsed in Results from the API are in plain text in JSON format to be easily parsed in
various languages (notably JavaScript). various languages (notably JavaScript).
This component must be publicly visible in the internet, so it is important to This component must be publicly visible on the internet, so it is important to
care about security and follow our recommendations. Security and user access care about security and follow our recommendations. Security and user access
restriction are among our primary concerns, so proper roles with permission restriction are among our primary concerns, so proper roles with permission
separation are introduced and maintained. Also some additional checks are made separation are introduced and maintained. Also some additional checks are made
@ -32,7 +32,7 @@ API architecture consists of several parts:
Each presenter method has several annotations. They are used for generating REST API documentation in [Swagger](http://swagger.io/), specifying request type and its parameters and specifying one level of access restrictions. Also, there is simple description of the endpoint. Each presenter method has several annotations. They are used for generating REST API documentation in [Swagger](http://swagger.io/), specifying request type and its parameters and specifying one level of access restrictions. Also, there is simple description of the endpoint.
For specifying the request type (_GET_, _POST_, _DELETE_) are used annotations with exactly these names without parameters. To describe request parameters is used `@Param` annotation with following arguments: For specifying the request type (_GET_, _POST_, _DELETE_) annotations with exactly these names without any parameters are used. To describe request parameters `@Param` annotation is used with following arguments:
- type -- the type of argument, one of _post_ of _query_ - type -- the type of argument, one of _post_ of _query_
- name -- name of the argument (the key) - name -- name of the argument (the key)
@ -41,7 +41,7 @@ For specifying the request type (_GET_, _POST_, _DELETE_) are used annotations w
- required -- specifies if this option is mandatory (`true`, default) or optional (`false`) - required -- specifies if this option is mandatory (`true`, default) or optional (`false`)
- description -- description for documentation of the API - description -- description for documentation of the API
Another annotation is `@LoggedIn` which takes no arguments. It can be placed before whole class or before a method, so requests from unauthorized users are forbidden. Permissions can be granted or prohibitted by `@UserIsAllowed` annotation. This one is only per method and takes one argument in format `key="value"`. The value specifies which action (_value_) of a resource (_key_) user need to be allowed to perform this request. Example how an annotated endpoint can look like: Another annotation is `@LoggedIn` which takes no arguments. It can be placed before a whole class or before a method, so requests from unauthorized users are forbidden. Permissions can be granted or prohibitted by `@UserIsAllowed` annotation. This one is only per method and takes one argument in `key="value"` format. The value specifies which action (_value_) of a resource (_key_) the user needs to be allowed to perform this request. An example of how an annotated endpoint can look like:
```{.php} ```{.php}
/** /**
@ -70,7 +70,7 @@ columns of database tables including types, indexes and also it is possible to
make mapping between entities. For detailed info refer to [official make mapping between entities. For detailed info refer to [official
documentation](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/). documentation](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/).
The API is capable of sending email messages. They can inform administrator about errors and users about submission evaluation or temporary link to change forgotten password. The [Nette Mail](https://doc.nette.org/en/2.4/mailing) extension provides nice interface for sending messages through external SMTP server (**preferred**) or builtin PHP function `mail`. It is important to set up the mailserver properly to ensure message delivery to the clients. The messages are rendered in HTML format via simple _Latte_ templates. The API is capable of sending email messages. They can inform an administrator about errors and users about submission evaluation or a temporary link to change forgotten password. The [Nette Mail](https://doc.nette.org/en/2.4/mailing) extension provides nice interface for sending messages through external SMTP server (**preferred**) or builtin PHP function `mail`. It is important to set up the mailserver properly to ensure message delivery to the clients. The messages are rendered in HTML format via simple _Latte_ templates.
### Authentication ### Authentication
@ -90,16 +90,16 @@ completely instead of just receiving session data through a global variable.
## Installation ## Installation
The web API requires a PHP runtime version at least 7. Which one depends on actual configuration, there is a choice between _mod_php_ inside Apache, _php-fpm_ with Apache or Nginx proxy or running it as standalone uWSGI script. Common thing is, that there are some PHP extensions, that have to be installed on the system. Namely ZeroMQ binding (`php-zmq` package or similar), MySQL module (`php-mysqlnd` package) and ldap extension module for CAS authentication (`php-ldap` package). Make sure that the extensions are loaded in your `php.ini` file (`/etc/php.ini` or files in `/etc/php.d/`). The web API requires a PHP runtime version at least 7. Which one depends on actual configuration, there is a choice between _mod_php_ inside Apache, _php-fpm_ with Apache or Nginx proxy or running it as standalone uWSGI script. It is common that there are some PHP extensions, that have to be installed on the system. Namely ZeroMQ binding (`php-zmq` package or similar), MySQL module (`php-mysqlnd` package) and ldap extension module for CAS authentication (`php-ldap` package). Make sure that the extensions are loaded in your `php.ini` file (`/etc/php.ini` or files in `/etc/php.d/`).
The API depends on some other projects and libraries. For managing them is used [Composer](https://getcomposer.org/). It can be installed from system repositories or downloaded from the website, where are also detailed instructions. Composer reads `composer.json` file in project root and install dependencies to `vendor/` subdirectory. To do that, run: The API depends on some other projects and libraries. For managing them [Composer](https://getcomposer.org/) is used. It can be installed from system repositories or downloaded from the website, where detailed instructions are as well. Composer reads `composer.json` file in the project root and installs dependencies to the `vendor/` subdirectory. To do that, run:
``` ```
$ composer install $ composer install
``` ```
## Configuration and usage ## Configuration and usage
The API can be configured in `config.neon` and `config.local.neon` files in `app/config` directory. The first file is predefined by authors and should not be modified. The second one is not present and could be created from template `config.local.neon.example` in the config directory. Local configuration have higher precedence, so it will override default values from `config.neon`. The API can be configured in `config.neon` and `config.local.neon` files in `app/config` directory. The first file is predefined by authors and should not be modified. The second one is not present and could be created from `config.local.neon.example` template in the config directory. Local configuration have higher precedence, so it will override default values from `config.neon`.
### Configurable items ### Configurable items

@ -14,7 +14,7 @@ created by Dan Abramov is used to manage the application state. Both of these fr
### Multiplatform approach ### Multiplatform approach
Since the runtime environment of *WebApp* is user's web browser it does not need any installation on enduser's device and does not require any particular platform or non-standard software installed on user's device. Since the runtime environment of *WebApp* is the user's web browser it does not need any installation on the enduser's device and does not require any particular platform or non-standard software installed on the user's device.
This application is designed and implemented in a way which should be suitable for modern web browsers on both desktop and mobile devices. This application is designed and implemented in a way which should be suitable for modern web browsers on both desktop and mobile devices.
## Architecture ## Architecture
@ -43,7 +43,7 @@ The redux [store](https://github.com/ReCodEx/web-app/blob/master/src/redux/store
#### apiMiddleware #### apiMiddleware
The API middleware catches all the `'CALL_API'` actions and turns them into a HTTP request via the [fetch API](https://developer.mozilla.org/en/docs/Web/API/Fetch_API). The middleware deeply converts data in the *body* part of the request to `FormData` and sets correctly the headers and creates endpoints for the API server before each request is sent. The middleware also handle the responses - converts them to the format expected by the reducers and catches requests' failures. The API middleware catches all the `CALL_API` actions and turns them into a HTTP request via the [fetch API](https://developer.mozilla.org/en/docs/Web/API/Fetch_API). The middleware deeply converts data in the *body* part of the request to `FormData` and sets correctly the headers and creates endpoints for the API server before each request is sent. The middleware also handle the responses - converts them to the format expected by the reducers and catches requests' failures.
#### accessTokenMiddleware #### accessTokenMiddleware
@ -75,7 +75,7 @@ The implementation of *WebApp* is split across more than a hundred small compone
- There is no technical difference between *containers* and *pages*. *Pages* are used as "root" components for different pages and are registered in the app's [router](https://github.com/ReactTraining/react-router). - There is no technical difference between *containers* and *pages*. *Pages* are used as "root" components for different pages and are registered in the app's [router](https://github.com/ReactTraining/react-router).
As was mentioned earlier in the text, there is over a hundred components in the whole application and most of them are very simple. Some of the most important and widely used components and described in the following paragraphs. As was mentioned earlier in the text, there is over a hundred components in the whole application and most of them are very simple. Some of the most important and widely used components are described in the following paragraphs.
#### App #### App
@ -125,7 +125,7 @@ A package [react-bootstrap](https://react-bootstrap.github.io/) is used. Compone
##### Box, FormBox ##### Box, FormBox
[Box](https://github.com/ReCodEx/web-app/blob/master/src/components/AdminLTE/Box/Box.js) is a frequently used component for bounding other components like text or tables inside. It is a re-styled `Panel` component from Bootstrap. It can be collapsable and can be displayed in different colors and types. [FormBox](https://github.com/ReCodEx/web-app/blob/master/src/components/AdminLTE/FormBox/FormBox.js) is just o wrapper of `Box` adjusted for holding forms inside of the body. [Box](https://github.com/ReCodEx/web-app/blob/master/src/components/AdminLTE/Box/Box.js) is a frequently used component for bounding other components like text paragraphs or tables inside. It is in fact a re-styled `Panel` component from Bootstrap. It can be collapsable and can be displayed in different colors and types. [FormBox](https://github.com/ReCodEx/web-app/blob/master/src/components/AdminLTE/FormBox/FormBox.js) is just a wrapper of `Box` adjusted for holding forms inside of the body.
##### CommentThread ##### CommentThread

@ -20,3 +20,5 @@
* [[FAQ]] * [[FAQ]]
* [[Logo]] * [[Logo]]
* [[Coding style]] * [[Coding style]]
* [[Database schema]]

Loading…
Cancel
Save