@@ -7,7 +7,7 @@ If you want to add a new grant, you have to do two things:
- Add the condition
You can see all the grants in the table 'grants_type', to add it automatically on start up the
backend you have to modify the functions ``_add_grants`` and ``_enable_grants`` in the file "lib/Ravada.pm"
backend you have to modify the functions ``_add_grants`` and ``_enable_grants`` in the file *lib/Ravada.pm*.
Now the test file is like this:
...
...
@@ -42,15 +42,34 @@ Now the test file is like this:
,'start_many'
);
...
Next for adding the conditions it depends of the situations but you may want to lock into thins functions:
Next for adding the conditions it depends of the situations but you may want to look into these files:
- "templates/main/settings_machine_tabs_head.html.ep" & "templates/main/settings_machine_tabs_head.html.ep" for Virtual Machine edit settings web page.
- "lib/Ravada/Auth/SQL.pm" all the grants conditions created (i.e. ``is_admin``, ``can_list_clones``, etc...).
**Note**:If the function is named ``can_'grant_name'`` this function is automatically generated with the BD data.
**Note**: The functions like ``can_'grant_name'`` are not individually implemented. This function is automatically generated with the BD data. Its code is at *lib/Ravada/Auth/SQL.pm* ``sub AUTOLOAD``.
Grant user permissions by default
---------------------------------
At *lib/Ravada/Auth/SQL*, the sub *grant_user_permissions* sets the default for new
users. If the new permission should be for everybody, add it there too.
Defaults and upgrading
----------------------
*This sections requires some review, please contribute if you can*
Some permissions are granted by default to all the users. So when creating
a new grant you should check:
- Old users are granted the new permissions
- Newly created users get the permission too
- Admin users get the permision, both old and new
Testing
-------
Some examples for testing can be found in "/t/user/50_admin.t" and "/t/user/40_grant_shutdown.t" also you may want to read the section **How to create tests**.
Some examples for testing can be found in */t/user/50_admin.t* and */t/user/40_grant_shutdown.t* also you may want to read the section **How to create tests**.
We use `Transifex <https://www.transifex.com/ravada/ravada/>`__ to
provide a cleaner and easy to use interface for translators.
.. centered:: |weblate2_widget|
New entries must be added in the ``en.po`` file.
Because it is the basis of the other language files.
You can translate Ravada at `Weblate <https://hosted.weblate.org/engage/ravada/>`__. As a feature rich computer aided translation tool, Weblate saves both developers and translators time.
.. Warning:: Please don't add new entries in other .po files directly. Use `Transifex <https://www.transifex.com/ravada/ravada/>`__ instead. If you want to collaborate, create an `Issue <https://github.com/UPC/ravada/issues/new>`_ and give you access as a translator of the language you want.
.. centered:: |weblate_widget|
.. image:: ../../img/translate.png
- Automated localization workflow
- Quality checks
- Attribution, all translator are properly credited
You can read weblate feaures `here <https://hosted.weblate.org/projects/ravada/#languages>`_.
Ravada weblate repository is updated from Github, and the contributions goes automatic to develop branch in Github.
New entries
-----------
New english entries must be added in the ``en.po`` file. It's the origin of the other language files. This new strings will be incorporated automatically in weblate.
.. Warning:: Please don't add new entries in other .po files directly. Use `Weblate <https://hosted.weblate.org/projects/ravada/translation/>`__ instead.
The language files are stored `here <https://github.com/UPC/ravada/tree/master/lib/Ravada/I18N/>`_ in lib/Ravada/I18N.
Before uploading the changes check if there are repeated msgid.
The ``msguniq`` command should not display any output lines.
::
When creating a new translation language, also add it in the frontend so it gets
listed for the end users. At around line 1337 in the ``sub _translation`` add