Miroir du site de l'AE UTBM https://ae.utbm.fr
Go to file
2016-04-20 03:30:49 +02:00
accounting Fix tests 2016-04-20 03:30:49 +02:00
club Improve accounting model according to current site's one 2016-04-20 02:07:01 +02:00
core Fix tests 2016-04-20 03:30:49 +02:00
counter Fix tests 2016-04-20 03:30:49 +02:00
doc Add contacts 2016-04-07 10:44:34 +02:00
sith Add basic accounting views 2016-04-20 03:01:14 +02:00
subscription Improve accounting model according to current site's one 2016-04-20 02:07:01 +02:00
.gitignore Add basic counter model 2016-03-28 14:54:35 +02:00
.gitlab-ci.yml Add setup step to CI 2016-04-20 03:05:23 +02:00
CONTRIBUTING.md jumplines 2016-03-07 13:36:06 +01:00
Doxyfile Add Doxyfile for generating doc 2016-01-29 16:23:41 +01:00
manage.py First commit: basic users 2015-11-18 09:44:06 +01:00
README.md Some refactoring and misc improvements 2016-02-05 16:59:42 +01:00
requirements.txt Update requirements.txt 2016-03-10 13:53:40 +01:00

Sith AE

Get started

To start working on the project, just run the following commands:

git clone https://ae-dev.utbm.fr/ae/Sith.git
cd Sith
virtualenv --clear --python=python3 env_sith
source env_sith/bin/activate
pip install -r requirements.txt
./manage.py setup

To start the simple development server, just run python3 manage.py runserver

Generating documentation

There is a Doxyfile at the root of the project, meaning that if you have Doxygen, you can run doxygen Doxyfile to generate a complete HTML documentation that will be available in the ./doc/html/ folder.

Dependencies:

See requirements.txt

The development is done with sqlite, but it is advised to set a more robust DBMS for production (Postgresql for example)

Misc about development

Controlling the rights

When you need to protect an object, there are three levels:

  • Editing the object properties
  • Editing the object various values
  • Viewing the object

Now you have many solutions in your model:

  • You can define a is_owned_by(self, user), a can_be_edited_by(self, user), and/or a can_be_viewed_by(self, user) method, each returning True is the user passed can edit/view the object, False otherwise.
    This allows you to make complex request when the group solution is not powerful enough.
    It's useful too when you want to define class-wide permissions, e.g. the club members, that are viewable only for Subscribers.
  • You can add an owner_group field, as a ForeignKey to Group. Second is an edit_groups field, as a ManyToMany to Group, and third is a view_groups, same as for edit.

Finally, when building a class based view, which is highly advised, you just have to inherit it from CanEditPropMixin, CanEditMixin, or CanViewMixin, which are located in core.views. Your view will then be protected using either the appropriate group fields, or the right method to check user permissions.