From d0760d450724b609750e4f37d5d7024e7ac8fbf8 Mon Sep 17 00:00:00 2001
From: Emmanuel Cazenave <ecazenave@entrouvert.com>
Date: Thu, 1 Oct 2020 16:28:13 +0200
Subject: [PATCH] wip

---
 src/authentic2/journal_event_types.py         |  60 ++++++----
 src/authentic2/manager/journal_event_types.py | 110 +++++++++++-------
 2 files changed, 101 insertions(+), 69 deletions(-)

diff --git a/src/authentic2/journal_event_types.py b/src/authentic2/journal_event_types.py
index 658cbd83..06285731 100644
--- a/src/authentic2/journal_event_types.py
+++ b/src/authentic2/journal_event_types.py
@@ -22,14 +22,15 @@ from authentic2.apps.journal.utils import form_to_old_new
 
 
 class UserEvents(EventTypeDefinition):
-    name = 'user'
+    name = 'user_events'
     label = _('user events')
     abstract = True
 
 
 class UserLogin(UserEvents):
-    name = 'login'
-    label = _('login')
+    name = 'user_login'
+    label = _('user_login')
+    trad = "connexion d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, service, how):
@@ -60,8 +61,9 @@ class UserLogin(UserEvents):
 
 
 class UserLoginFailure(UserEvents):
-    name = 'login_failure'
-    label = _('login failure')
+    name = 'user_login_failure'
+    label = _('user login failure')
+    trad = "échec de connexion d'un utilisateur"
 
     @classmethod
     def record(cls, username):
@@ -77,8 +79,9 @@ class UserLoginFailure(UserEvents):
 
 
 class UserRequestRegistration(UserEvents):
-    name = 'request_registration'
-    label = _('request registration')
+    name = 'user_request_registration'
+    label = _('user request registration')
+    trad = "demande de création de compte"
 
     @classmethod
     def record(cls, email):
@@ -93,8 +96,9 @@ class UserRequestRegistration(UserEvents):
 
 
 class UserRegister(UserEvents):
-    name = 'register'
-    label = _('register')
+    name = 'user_register'
+    label = _('user register')
+    traduction = "création de compte"
 
     @classmethod
     def record(cls, user, session, service, how):
@@ -123,8 +127,9 @@ class UserRegister(UserEvents):
 
 
 class UserLogout(UserEvents):
-    name = 'logout'
-    label = _('logout')
+    name = 'user_logout'
+    label = _('user logout')
+    trad = "déconnexion d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, service):
@@ -135,8 +140,9 @@ class UserLogout(UserEvents):
 
 
 class UserRequestPasswordReset(UserEvents):
-    name = 'request_password_reset'
-    label = _('request password reset')
+    name = 'password_reset_request'
+    label = _('password reset request')
+    trad = "demande de réinitialisation de mot de passe"
 
     @classmethod
     def record(cls, email, user):
@@ -153,8 +159,9 @@ class UserRequestPasswordReset(UserEvents):
 
 
 class UserResetPassword(UserEvents):
-    name = 'reset_password'
-    label = _('reset password')
+    name = 'password_reset'
+    label = _('password reset')
+    trad = "réinitialisation de mot de passe"
 
     @classmethod
     def record(cls, user, session, service):
@@ -165,8 +172,9 @@ class UserResetPassword(UserEvents):
 
 
 class UserResetPasswordFailure(UserEvents):
-    name = 'reset_password_failure'
+    name = 'password_reset_failure'
     label = _('password reset failure')
+    trad = "échec de réinitialisation de mot de passe"
 
     @classmethod
     def record(cls, email):
@@ -177,8 +185,9 @@ class UserResetPasswordFailure(UserEvents):
 
 
 class UserChangePassword(UserEvents):
-    name = 'change_password'
-    label = _('change password')
+    name = 'password_change'
+    label = _('password change')
+    trad = "changement de mot de passe"
 
     @classmethod
     def record(cls, user, session, service):
@@ -189,8 +198,9 @@ class UserChangePassword(UserEvents):
 
 
 class UserEdit(UserEvents):
-    name = 'edit'
-    label = _('edit')
+    name = 'user_edition'
+    label = _('user edition')
+    trad = "édition d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, service, form=None, old=None, new=None):
@@ -215,8 +225,9 @@ class SSOEvents(UserEvents):
 
 
 class SSOAuthorize(SSOEvents):
-    name = 'authorize'
-    label = _('authorize single sign on')
+    name = 'sso_authorization'
+    label = _('single sign on authorization')
+    trad = "authorisation d'authentification unique"
 
     @classmethod
     def record(cls, user, session, service, **kwargs):
@@ -228,8 +239,9 @@ class SSOAuthorize(SSOEvents):
 
 
 class SSOLogin(SSOEvents):
-    name = 'login'
-    label = _('single sign on')
+    name = 'sso_login'
+    label = _('single sign on login')
+    trad = "connexion par authentification unique"
 
     @classmethod
     def record(cls, user, session, service, how):
diff --git a/src/authentic2/manager/journal_event_types.py b/src/authentic2/manager/journal_event_types.py
index dd68a78c..0eabd0d2 100644
--- a/src/authentic2/manager/journal_event_types.py
+++ b/src/authentic2/manager/journal_event_types.py
@@ -28,20 +28,21 @@ Role = get_role_model()
 
 
 class ManagerEvents(EventTypeDefinition):
-    name = 'manager'
+    name = 'manager_events'
     label = _('manager events')
     abstract = True
 
 
 class UserEvents(ManagerEvents):
-    name = 'user'
-    label = _('user manager events')
+    name = 'user_events'
+    label = _('user events')
     abstract = True
 
 
 class UserCreation(UserEvents):
-    name = 'create'
-    label = _('create')
+    name = 'user_creation'
+    label = _('user creation')
+    trad = "création d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, form):
@@ -60,8 +61,9 @@ class UserCreation(UserEvents):
 
 
 class EditUser(UserEvents):
-    name = 'edit'
-    label = _('edit')
+    name = 'user_editing'
+    label = _('user editing')
+    trad = "édition d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, form):
@@ -82,8 +84,9 @@ class EditUser(UserEvents):
 
 
 class ChangePassword(UserEvents):
-    name = 'change_password'
-    label = _('change password')
+    name = 'password_change'
+    label = _('password change')
+    trad = "changement de mot de passe"
 
     @classmethod
     def record(cls, user, session, form):
@@ -110,8 +113,9 @@ class ChangePassword(UserEvents):
 
 
 class ChangeEmailRequest(UserEvents):
-    name = 'request_email_change'
-    label = _('request email change')
+    name = 'change_email_request'
+    label = _('change email request')
+    trad = "demande de changement de courriel"
 
     @classmethod
     def record(cls, user, session, form):
@@ -162,8 +166,9 @@ class DoNotForcePasswordChange(UserEvents):
 
 
 class ActivateUser(UserEvents):
-    name = 'activation'
-    label = _('activate user')
+    name = 'user_activation'
+    label = _('user activation')
+    trad = "activation d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, target_user):
@@ -174,8 +179,9 @@ class ActivateUser(UserEvents):
 
 
 class DeactivateUser(UserEvents):
-    name = 'deactivation'
-    label = _('deactivate user')
+    name = 'user_deactivation'
+    label = _('user deactivation')
+    trad = "désactivation d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, target_user):
@@ -186,8 +192,9 @@ class DeactivateUser(UserEvents):
 
 
 class PasswordReset(UserEvents):
-    name = 'send_password_reset_email'
-    label = _('send password reset email')
+    name = 'password_reset_email'
+    label = _('password reset email')
+    trad = "courriel de réinitialisation de mot de passe"
 
     @classmethod
     def record(cls, user, session, target_user):
@@ -199,8 +206,9 @@ class PasswordReset(UserEvents):
 
 
 class DeleteUser(UserEvents):
-    name = 'delete'
-    label = _('delete')
+    name = 'user_deletion'
+    label = _('user deletion')
+    trad = "suppression d'un utilisateur"
 
     @classmethod
     def record(cls, user, session, target_user):
@@ -211,8 +219,9 @@ class DeleteUser(UserEvents):
 
 
 class DeleteAuthorization(UserEvents):
-    name = 'delete_authorization'
-    label = _('delete authorization')
+    name = 'authorization_deletion'
+    label = _('authorization deletion')
+    trad = "suppression d'une autorisation"
 
     @classmethod
     def record(cls, user, session, service, target_user):
@@ -224,8 +233,8 @@ class DeleteAuthorization(UserEvents):
 
 
 class RoleEvents(ManagerEvents):
-    name = 'role'
-    label = _('role manager events')
+    name = 'role_management_event'
+    label = _('role management event')
     abstract = True
 
     @classmethod
@@ -246,13 +255,15 @@ class RoleEvents(ManagerEvents):
 
 
 class CreateRole(RoleEvents):
-    name = 'create'
-    label = _('creation')
+    name = 'role_creation'
+    label = _('role creation')
+    trad = "création d'un rôle"
 
 
 class EditRole(RoleEvents):
-    name = 'edit'
-    label = _('edit')
+    name = 'role_editing'
+    label = _('role editing')
+    trad = "édition d'un rôle"
 
     @classmethod
     def record(cls, user, session, role, form):
@@ -266,13 +277,15 @@ class EditRole(RoleEvents):
 
 
 class DeleteRole(RoleEvents):
-    name = 'delete'
-    label = _('deletion')
+    name = 'role_deletion'
+    label = _('role deletion')
+    trad = "suppression d'un rôle"
 
 
 class AddMember(RoleEvents):
-    name = 'add_member'
-    label = _('add member')
+    name = 'role_member_addition'
+    label = _('role member addition')
+    trad = "ajout d'un membre à un rôle"
 
     @classmethod
     def record(cls, user, session, role, member):
@@ -296,8 +309,9 @@ class AddMember(RoleEvents):
 
 
 class RemoveMember(RoleEvents):
-    name = 'remove_member'
-    label = _('remove member')
+    name = 'role_member_removal'
+    label = _('role member removal')
+    trad = "suppression d'un membre à un rôle"
 
     @classmethod
     def record(cls, user, session, role, member):
@@ -321,8 +335,9 @@ class RemoveMember(RoleEvents):
 
 
 class AddChild(RoleEvents):
-    name = 'add_child'
-    label = _('add child role')
+    name = 'child_role_addition'
+    label = _('child role addition')
+    trad = "ajout d'un rôle enfant"
 
     @classmethod
     def record(cls, user, session, parent, child):
@@ -339,8 +354,9 @@ class AddChild(RoleEvents):
 
 
 class RemoveChild(RoleEvents):
-    name = 'remove_child'
-    label = _('remove child role')
+    name = 'child_role_removal'
+    label = _('child role removal')
+    trad = "suppression d'un rôle enfant"
 
     @classmethod
     def record(cls, user, session, parent, child):
@@ -357,8 +373,9 @@ class RemoveChild(RoleEvents):
 
 
 class AddAdminRole(RoleEvents):
-    name = 'add_admin_role'
-    label = _('add administration by role')
+    name = 'admin_role_addition'
+    label = _('administration role adition')
+    trad = "ajout d'un rôle adminstrateur"
 
     @classmethod
     def record(cls, user, session, role, admin_role):
@@ -375,8 +392,9 @@ class AddAdminRole(RoleEvents):
 
 
 class RemoveAdminRole(RoleEvents):
-    name = 'remove_admin_role'
-    label = _('remove administration by role')
+    name = 'admin_role_removal'
+    label = _('administration role removal')
+    trad = "suppression d'un rôle adminstrateur"
 
     @classmethod
     def record(cls, user, session, role, admin_role):
@@ -393,8 +411,9 @@ class RemoveAdminRole(RoleEvents):
 
 
 class AddAdminUser(RoleEvents):
-    name = 'add_admin_user'
-    label = _('add administration by user')
+    name = 'admin_user_addition'
+    label = _('administration user addition')
+    trad = "ajout d'un utilisateur administrateur"
 
     @classmethod
     def record(cls, user, session, role, admin_user):
@@ -411,8 +430,9 @@ class AddAdminUser(RoleEvents):
 
 
 class RemoveAdminUser(RoleEvents):
-    name = 'remove_admin_user'
-    label = _('remove administration by user')
+    name = 'radmin_user_removal'
+    label = _('administration user removal')
+    trad = "suppression d'un utilisateur administrateur"
 
     @classmethod
     def record(cls, user, session, role, admin_user):
-- 
2.20.1

