Updated Rake tasks (markdown)

Luka Murn 2018-09-12 10:45:52 +02:00
parent bb2208d7ec
commit ce214fd074

@ -17,7 +17,7 @@ rails jobs:clear
```
> **Warning!** This is not advised to do on production environments.
### Adding users
## Adding users
To simplify adding of new users to the system, couple of special `rails` tasks have been created.
@ -27,16 +27,48 @@ The second task, `rails db:load_users[file_path,create_orgs]` takes 2 parameters
* Path to `.yml` file containing list of users & teams to be added. The YAML file needs to be structured properly - field names must match those in the database, users need to have a name `user_<id>`, and teams name `team_<id>`. For an example load users file, see [db/load_users_template.yml](https://github.com/biosistemika/scinote-web/blob/master/db/load_users_template.yml) file.
* A boolean ('true' or 'false') whether to create individual teams for each user or not.
## Data
### Team export & import
All data belonging to a single team (including users) can be exported into a portable format (`.json` master file + folder with all files). To generate an export of individual team, execute the following task: `rails data:team_export[team_id]`. This will generate a `.json` master file, and the folder with all team files, in the `/tmp` directory.
SciNote allows to import all data from this portable format for an individual team into the database. To import the team data, execute the following task: `rails data:team_import[path_to_folder]`.
> **WARNING!** All team users are also ported alongside the team export, but the import script currently doesn't handle user collisions & duplicates.
### Team deletion
All data belonging to an individual team can be deleted from within SciNote. This can be done by executing: `rails data:team_delete[team_id]`
> **WARNING!** This is a non-revertible action!
### Cleaning temporary & obsolete data
There are various temporary files that are generated in scope of normal SciNote operations (e.g. when importing samples, when generating various exports, etc.). These files can safely be removed after a period of time.
* Execute `rails data:clean_temp_files` to remove all temporary files generated from imports;
* execute `rails exportable_items:cleanup`, to remove all exportable items that are past their availability;
* execute `rails tiny_mce_asset:remove_obsolete_images` to remove all TinyMCE images which were uploaded into SciNote, but their result/step/... was not saved at the end.
In a similar fashion, users that were either invited, or registered (while having "confirm registrations" flag on), but never confirmed their registration, can safely be deleted after a period of time. Execute `rails data:clean_unconfirmed_users` to remove all such users.
Calling `rails data:clean` will execute both `data:clean_temp_files` and `data:clean_unconfirmed_users` tasks.
## Miscellaneous
### Notifications
To generate a new system notification that will be sent to all SciNote users, execute `rails notifications:new_system[title, message]`. Title & message can contain `HTML` tags.
### Web statistics
To check current login statistics of registered users, use `rails web_stats:login` task. To check the last login of any user to the system, use `rails web_stats:last_login` task.
### Clearing data
### Limit the domain for registrations
Execute `rails data:clean_temp_files` to remove all temporary files. Temporary files are used when importing samples.
Execute `rails data:clean_unconfirmed_users` to remove all users that registered, but never confirmed their email.
Calling `rails data:clean` will execute both above tasks.
By using PostgreSQL constraints, it is possible to enforce that all SciNote users' emails (existing and new users) belong to the specific domain (e.g. `yourcompany.com`). To setup the constraint, run the following task: `rails sign_up_constraint:email_domain[domain]`. To drop the constraint, run the task: `rails sign_up_constraint:remove_domain`.
### Notifications
### Release names
To generate a new system notification that will be sent to all SciNote users, execute `rails notifications:new_system[title, message]`. Title & message can contain `HTML` tags.
To generate a new, quirky release name (from a predefined list of scientists and adjectives), execute `rails versions:generate_release_name`.