GitLab now enforces expiry dates on tokens that originally had no set expiration date. Those tokens were given an expiration date of one year later. Please review your personal access tokens, project access tokens, and group access tokens to ensure you are aware of upcoming expirations. Administrators of GitLab can find more information on how to identify and mitigate interruption in our documentation.
This application aim to provide restful access to [[Storm http://git.afi-sa.fr/afi/storm]] enabled models.
\ No newline at end of file
This application aim to provide restful access to [Storm](http://git.afi-sa.fr/afi/storm) enabled models.
## Installation
### Requirements
You need Apache with rewrite module, PHP 5.4+ and MySQL 5+.
Obviously you also need [Storm](http://git.afi-sa.fr/afi/storm).
This application defines a git submodule for Storm which itself defines a submodule for a customized Zend Framework 1.6. Please see git documentation te learn more about submodules.
> tip : `/build.sh` contains commands to init and update them recursively
### Storm models
Creating Storm models for your datas is trivial.
```
class My_Model extends Storm_Model_Abstract {
protected $_table_name = 'my_table_name';
protected $_table_primary = 'id_table_name'; // needed only if PK is not named 'id'
}
```
From here you can use Storm super powers to access and manipulate your datas.
See [Storm documentation](http://git.afi-sa.fr/afi/storm/blob/master/README.md) to learn more.
### Configuration
Copy `/config.php.dist` to `/config.php` and edit it.
`sgbd` section should be self explanatory
`modelspath` should contain base path to your Storm enabled models.
They should follow Zend Framework 1.x class loader naming convention : **My_Storm_Model** should reside in **My/Storm/Model.php** file.
`models` contains access and capabilities configuration array.
* key contains model's name
* value is an array
* caps contains capabilities name separated by ';' between index, show, create, update, delete
* fields contains fields name separated by ';', those fields will be included in JSON responses, 'id' field is always included
```
'models' => [
Class_Album' => [
'caps' => 'index;show',
'fields' => 'titre']]
```
'*' can be used as an "allow all" wildcard.
* as a model name allow access to all your models
* as a caps value allow all capabilities
* as a fields value allow display of all fields in JSON response
Then you can define a read all access as
```
'models' => [
'*' => [
'caps' => 'index;show',
'fields' => '*']]
```
And you can combine default access with specifics.
```
'models' => [
'*' => [ // any models
'caps' => 'index;show', // is searchable and showable
'fields' => ''], // but only show its id, no other fields
'Class_Album' => [ // this model
'caps' => '*', // is fully handled in this app
'fields' => '*', // and show all its fields
]]
```
## Usage
### Catalog
Accessing `/catalog` URL will show a page reflecting your configuration.