Skip to content
Camille Masset edited this page May 4, 2016 · 2 revisions

Users

General facts

The model User is quite classical: it gathers basic data about the user (name, email, profile photo, ...).
The users are related to other objects in the application:

  • cluster: a user must be member of at least one cluster;
  • groups: a user can be a member of a group:
    • if a user is invited to a group, the group is visible in its invited_to_groups field;
    • if a user belongs to a group, the membership is in the field groups (which is a list).

Proper fields

  • email (string) : is used for authentication
  • lastname (string)
  • firstname (string)
  • username (string, should be unique #TODO)
  • phone (string, 21 chars)
  • photo (model sigma_files.Image)
  • is_active (boolean, default: True)
  • last_modified (datetime)
  • join_date (datetime)
  • is_superuser (boolean, default: False)
  • is_staff (boolean, default: False)

Relation fields

  • clusters (M2M with Cluster, related name: cluster_users) : users should be members of at least one cluster
  • invited_to_groups (M2M with Group , related name: invited_users)
  • groups (M2M with Group through GroupMember, related name: users)

Permissions

We describe here the permissions concerning the users instances (and not what users are allowed to do).

We have implemented the permissions in order to respect the following rules:

  • one can see another user's information if one is in the same cluster or if one belongs to a common group;
  • one cannot modify a user, except oneself;
  • one cannot delete a user, except oneself or if we are a Sigma admin.

All these rules should be implemented in the UserViewSet.

Clone this wiki locally