micro-users 1.4.1__tar.gz → 1.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of micro-users might be problematic. Click here for more details.

Files changed (49) hide show
  1. {micro_users-1.4.1 → micro_users-1.6.1}/PKG-INFO +57 -133
  2. {micro_users-1.4.1 → micro_users-1.6.1}/README.md +56 -133
  3. {micro_users-1.4.1 → micro_users-1.6.1}/micro_users.egg-info/PKG-INFO +57 -133
  4. {micro_users-1.4.1 → micro_users-1.6.1}/micro_users.egg-info/SOURCES.txt +14 -5
  5. {micro_users-1.4.1 → micro_users-1.6.1}/pyproject.toml +4 -1
  6. {micro_users-1.4.1 → micro_users-1.6.1}/setup.py +1 -1
  7. micro_users-1.6.1/users/admin.py +37 -0
  8. {micro_users-1.4.1 → micro_users-1.6.1}/users/apps.py +2 -1
  9. {micro_users-1.4.1 → micro_users-1.6.1}/users/filters.py +6 -6
  10. {micro_users-1.4.1 → micro_users-1.6.1}/users/forms.py +37 -14
  11. micro_users-1.6.1/users/middleware.py +32 -0
  12. micro_users-1.6.1/users/migrations/0003_scope_alter_customuser_options_and_more.py +47 -0
  13. {micro_users-1.4.1 → micro_users-1.6.1}/users/models.py +20 -1
  14. micro_users-1.6.1/users/signals.py +139 -0
  15. micro_users-1.6.1/users/static/img/login_logo.webp +0 -0
  16. {micro_users-1.4.1/users/static → micro_users-1.6.1/users/static/users}/css/login.css +50 -43
  17. micro_users-1.6.1/users/static/users/css/style.css +201 -0
  18. micro_users-1.6.1/users/static/users/js/anime.min.js +8 -0
  19. micro_users-1.6.1/users/static/users/js/login.js +60 -0
  20. {micro_users-1.4.1 → micro_users-1.6.1}/users/tables.py +29 -7
  21. micro_users-1.6.1/users/templates/registration/login.html +75 -0
  22. micro_users-1.6.1/users/templates/users/manage_users.html +158 -0
  23. micro_users-1.6.1/users/templates/users/partials/scope_actions.html +9 -0
  24. micro_users-1.6.1/users/templates/users/partials/scope_form.html +19 -0
  25. micro_users-1.6.1/users/templates/users/partials/scope_manager.html +12 -0
  26. {micro_users-1.4.1/users/templates → micro_users-1.6.1/users/templates/users}/user_activity_log.html +2 -0
  27. {micro_users-1.4.1 → micro_users-1.6.1}/users/urls.py +9 -1
  28. {micro_users-1.4.1 → micro_users-1.6.1}/users/views.py +165 -24
  29. micro_users-1.4.1/users/admin.py +0 -18
  30. micro_users-1.4.1/users/signals.py +0 -41
  31. micro_users-1.4.1/users/templates/registration/login.html +0 -115
  32. micro_users-1.4.1/users/templates/users/manage_users.html +0 -70
  33. {micro_users-1.4.1 → micro_users-1.6.1}/LICENSE +0 -0
  34. {micro_users-1.4.1 → micro_users-1.6.1}/MANIFEST.in +0 -0
  35. {micro_users-1.4.1 → micro_users-1.6.1}/micro_users.egg-info/dependency_links.txt +0 -0
  36. {micro_users-1.4.1 → micro_users-1.6.1}/micro_users.egg-info/requires.txt +0 -0
  37. {micro_users-1.4.1 → micro_users-1.6.1}/micro_users.egg-info/top_level.txt +0 -0
  38. {micro_users-1.4.1 → micro_users-1.6.1}/setup.cfg +0 -0
  39. {micro_users-1.4.1 → micro_users-1.6.1}/users/__init__.py +0 -0
  40. {micro_users-1.4.1 → micro_users-1.6.1}/users/migrations/0001_initial.py +0 -0
  41. {micro_users-1.4.1 → micro_users-1.6.1}/users/migrations/0002_alter_useractivitylog_action.py +0 -0
  42. {micro_users-1.4.1 → micro_users-1.6.1}/users/migrations/__init__.py +0 -0
  43. {micro_users-1.4.1 → micro_users-1.6.1}/users/static/img/default_profile.webp +0 -0
  44. {micro_users-1.4.1/users/templates/users → micro_users-1.6.1/users/templates/users/partials}/user_actions.html +0 -0
  45. {micro_users-1.4.1/users/templates/users → micro_users-1.6.1/users/templates/users/profile}/profile.html +0 -0
  46. {micro_users-1.4.1/users/templates/users → micro_users-1.6.1/users/templates/users/profile}/profile_edit.html +0 -0
  47. {micro_users-1.4.1 → micro_users-1.6.1}/users/templates/users/user_detail.html +0 -0
  48. {micro_users-1.4.1 → micro_users-1.6.1}/users/templates/users/user_form.html +0 -0
  49. {micro_users-1.4.1 → micro_users-1.6.1}/users/templates/users/widgets/grouped_permissions.html +0 -0
@@ -1,11 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: micro_users
3
- Version: 1.4.1
3
+ Version: 1.6.1
4
4
  Summary: Arabic Django user management app with abstract user, permissions, and activity logging
5
5
  Home-page: https://github.com/debeski/micro-users
6
6
  Author: DeBeski
7
7
  Author-email: DeBeski <debeski1@gmail.com>
8
8
  License: MIT
9
+ Project-URL: Homepage, https://github.com/debeski/micro-users
9
10
  Keywords: django,users,permissions,authentication
10
11
  Classifier: Framework :: Django
11
12
  Classifier: Framework :: Django :: 5
@@ -33,6 +34,10 @@ Requires-Dist: babel>=2.1
33
34
 
34
35
  [![PyPI version](https://badge.fury.io/py/micro-users.svg)](https://pypi.org/project/micro-users/)
35
36
 
37
+ <p align="center">
38
+ <img src="https://raw.githubusercontent.com/debeski/micro-users/main/users/static/img/login_logo.webp" alt="Micro Users Login Logo" width="200"/>
39
+ </p>
40
+
36
41
  **Arabic** lightweight, reusable Django app providing user management with abstract user, permissions, localization, and activity logging.
37
42
 
38
43
  ## Requirements
@@ -47,9 +52,10 @@ Requires-Dist: babel>=2.1
47
52
 
48
53
  ## Features
49
54
  - Custom AbstractUser model
50
- - User permissions system
51
- - Activity logging (login/logout, CRUD tracking)
52
- - Specific User detail and log view *new*
55
+ - Scope Management System (replaces Department)
56
+ - Custom Grouped User permissions system
57
+ - Automatic Activity logging (login/logout, CRUD for all models)
58
+ - Specific User detail and log view
53
59
  - Localization support
54
60
  - Admin interface integration
55
61
  - CRUD views and templates
@@ -76,12 +82,22 @@ INSTALLED_APPS = [
76
82
  ]
77
83
  ```
78
84
 
79
- 2. Set custom user model in settings.py:
85
+ 2. Add Middleware in `settings.py` (Required for logging):
86
+ ```python
87
+ MIDDLEWARE = [
88
+ # ...
89
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
90
+ # ...
91
+ 'users.middleware.ActivityLogMiddleware', # Add this line
92
+ ]
93
+ ```
94
+
95
+ 3. Set custom user model in `settings.py`:
80
96
  ```python
81
97
  AUTH_USER_MODEL = 'users.CustomUser'
82
98
  ```
83
99
 
84
- 3. Include URLs in your main project folder `urls.py`:
100
+ 4. Include URLs in your main project folder `urls.py`:
85
101
  ```python
86
102
  urlpatterns = [
87
103
  ...
@@ -89,7 +105,7 @@ urlpatterns = [
89
105
  ]
90
106
  ```
91
107
 
92
- 4. Run migrations:
108
+ 5. Run migrations:
93
109
  ```bash
94
110
  python manage.py migrate users
95
111
  ```
@@ -100,136 +116,18 @@ Once configured, the app automatically handles user management and activity logg
100
116
 
101
117
  ### Activity Logging
102
118
 
103
- The app automatically logs **LOGIN** and **LOGOUT** actions. For custom logging of other actions in your application, you can use the following helper functions:
104
-
105
- #### Available Helper Functions
106
-
107
- 1. **Get Client IP** - Extract the user's IP address from request:
108
- ```python
109
- from users.signals import get_client_ip
110
-
111
- # Usage in views
112
- ip_address = get_client_ip(request)
113
- ```
114
-
115
- 2. **Log User Action** - Create a reusable logging function:
116
- ```python
117
- from django.utils import timezone
118
- from users.models import UserActivityLog
119
- from users.signals import get_client_ip
120
-
121
- def log_user_action(request, instance, action, model_name):
122
- """
123
- Logs a user action to the activity log.
124
-
125
- Args:
126
- request: HttpRequest object
127
- instance: The model instance being acted upon
128
- action: Action type (see ACTION_TYPES below)
129
- model_name: Name of the model/entity (in Arabic or English)
130
- """
131
- UserActivityLog.objects.create(
132
- user=request.user,
133
- action=action,
134
- model_name=model_name,
135
- object_id=instance.pk,
136
- number=instance.number if hasattr(instance, 'number') else '',
137
- timestamp=timezone.now(),
138
- ip_address=get_client_ip(request),
139
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
140
- )
141
- ```
142
-
143
- #### Action Types Available
144
- Use these constants when logging actions:
145
-
146
- | Action Constant | Arabic Display | Description |
147
- |-----------------|----------------|-------------|
148
- | `'LOGIN'` | تسجيل دخـول | User login (auto-logged) |
149
- | `'LOGOUT'` | تسجيل خـروج | User logout (auto-logged) |
150
- | `'CREATE'` | انشـاء | Object creation |
151
- | `'UPDATE'` | تعديـل | Object modification |
152
- | `'DELETE'` | حــذف | Object deletion |
153
- | `'VIEW'` | عـرض | Object viewing |
154
- | `'DOWNLOAD'` | تحميل | File download |
155
- | `'CONFIRM'` | تأكيـد | Action confirmation |
156
- | `'REJECT'` | رفــض | Action rejection |
157
- | `'RESET'` | اعادة ضبط | Password/Data reset |
119
+ The app provides a fully **automated** activity logging system. No manual configuration is required in your views.
158
120
 
159
- #### Usage Examples
121
+ - **Login/Logout**: Automatically tracked.
122
+ - **Create/Update/Delete**: Any change to any model in your app (including `Scope` and `User`) is automatically logged via Django Signals.
123
+ - **Log content**: Tracks the user, action type, model name, object ID, and timestamp.
124
+ - *Note*: `last_login` field updates are automatically filtered out to prevent redundant "Update" logs on login.
160
125
 
161
- 1. **Logging a CREATE action**:
162
- ```python
163
- def create_document(request):
164
- # ... create logic ...
165
- document = Document.objects.create(...)
166
-
167
- # Log the action
168
- from users.models import UserActivityLog
169
- from users.signals import get_client_ip
170
-
171
- UserActivityLog.objects.create(
172
- user=request.user,
173
- action='CREATE',
174
- model_name='وثيقة',
175
- object_id=document.pk,
176
- number=document.number,
177
- ip_address=get_client_ip(request),
178
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
179
- )
180
- ```
181
-
182
- 2. **Using the helper function**:
183
- ```python
184
- # Create a helper function in your app
185
- def log_action(request, instance, action, model_name):
186
- from users.models import UserActivityLog
187
- from users.signals import get_client_ip
188
- from django.utils import timezone
189
-
190
- UserActivityLog.objects.create(
191
- user=request.user,
192
- action=action,
193
- model_name=model_name,
194
- object_id=instance.pk,
195
- number=getattr(instance, 'number', ''),
196
- timestamp=timezone.now(),
197
- ip_address=get_client_ip(request),
198
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
199
- )
200
-
201
- # Usage in views
202
- def update_order(request, order_id):
203
- order = get_object_or_404(Order, pk=order_id)
204
- # ... update logic ...
205
- log_action(request, order, 'UPDATE', 'طلب')
206
- ```
207
-
208
- 3. **Logging without an instance** (for general actions):
209
- ```python
210
- def log_general_action(request, action, model_name, description=''):
211
- from users.models import UserActivityLog
212
- from users.signals import get_client_ip
213
- from django.utils import timezone
214
-
215
- UserActivityLog.objects.create(
216
- user=request.user,
217
- action=action,
218
- model_name=model_name,
219
- object_id=None,
220
- number=description,
221
- timestamp=timezone.now(),
222
- ip_address=get_client_ip(request),
223
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
224
- )
225
-
226
- # Usage
227
- log_general_action(request, 'CONFIRM', 'نظام', 'تم تأكيد الإعدادات')
228
- ```
126
+ To view logs, navigate to `manage/logs/` or use the Django Admin interface ("حركات السجل").
229
127
 
230
128
  ## Available URLs
231
129
 
232
- All user management URLs are prefixed with `manage/` as configured. Below is the complete list:
130
+ All user management URLs are prefixed with `manage/` as configured above. Below is the complete list:
233
131
 
234
132
  | URL Pattern | View/Function | Description |
235
133
  |-------------|---------------|-------------|
@@ -244,6 +142,7 @@ All user management URLs are prefixed with `manage/` as configured. Below is the
244
142
  | `manage/profile/edit/` | `views.edit_profile` | Edit current profile |
245
143
  | `manage/logs/` | `views.UserActivityLogView.as_view()` | View activity logs |
246
144
  | `manage/reset_password/<int:pk>/` | `views.reset_password` | Reset user password |
145
+ | `manage/scopes/manage/` | `views.manage_scopes` | Scope Manager (Modal) |
247
146
 
248
147
  ## Structure
249
148
  ```
@@ -252,17 +151,39 @@ users/
252
151
  ├── urls.py # URL routing
253
152
  ├── tables.py # User and Activity Log tables
254
153
  ├── signals.py # Logging signals
154
+ ├── middleware.py # Request capture for signals
255
155
  ├── models.py # User model, permissions, activity logs
256
156
  ├── forms.py # Creation, edit,. etc.
257
157
  ├── filter.py # Search filters
258
158
  ├── apps.py # Permissions Localization
259
159
  ├── admin.py # Admin UI integration
260
160
  ├── __init__.py # Python init
261
- ├── templates/ # HTML templates
161
+ ├── templates/ # HTML templates (includes partials)
262
162
  ├── static/ # CSS classes
263
163
  └── migrations/ # Database migrations
264
164
  ```
265
165
 
166
+ ## Customization
167
+
168
+ ### Replacing Login Logo
169
+ To replace the default login logo, simply place your own `login_logo.webp` image in your project's static directory at `static/img/login_logo.webp`.
170
+
171
+ ### Theme Configuration
172
+ You can configure the login page colors by defining `MICRO_USERS_THEME` in your project's `settings.py`. This dictionary overrides the default CSS variables.
173
+
174
+ ```python
175
+ MICRO_USERS_THEME = {
176
+ 'right_bg': '#474745',
177
+ 'left_bg': 'white',
178
+ 'selection_bg': '#dbdbdb',
179
+ 'gradient_start': '#a2a2a7',
180
+ 'gradient_end': '#474745',
181
+ # Additional keys supported:
182
+ # 'selection_moz_bg', 'left_shadow', 'right_shadow', 'right_text',
183
+ # 'label_color', 'input_text', 'submit_color', 'submit_focus', 'submit_active'
184
+ }
185
+ ```
186
+
266
187
  ## Version History
267
188
 
268
189
  | Version | Changes |
@@ -283,3 +204,6 @@ users/
283
204
  | v1.3.2 | • Minor table modifications |
284
205
  | v1.4.0 | • Redesigned Permissions UI (Grouped by App/Action) <br> • Added Global Bulk Permission Selectors <br> • Improved Arabic Localization for Permissions <br> • Optimized printing (hidden forms/buttons) <br> • Fixed various bugs and crashes |
285
206
  | v1.4.1 | • Changed "Administrative User" translation to "Responsible User" (مستخدم مسؤول) <br> • Enforced custom sorting order for Permissions (View -> Add -> Change -> Other) |
207
+ | v1.5.0 | • Department Management (Modal-based CRUD)<br> • Department field implementation<br> • Template refactoring (partials/, profile/, users/ for logs)<br> • Verbose names for models |
208
+ | v1.6.0 | • **Automated Activity Logging**: dynamic logging for all CREATE/UPDATE/DELETE actions via Middleware & Signals<br> • **Refactor**: Renamed `Department` model to `Scope` (Scope Management)<br> • Removed manual logging requirement<br> • **Architecture**: Decoupled models, forms, and tables using dynamic imports and `apps.get_model` <br> • **Soft Delete**: Users are now marked as inactive with a timestamp instead of being permanently deleted<br> • **Activity Log**: Deleted users appear with a strikethrough<br> • **CSS Refactor**: Extracted and cleaned up styling with CSS variables<br> • **Login**: Refactored login page with separated JS/CSS and a new modern default logo |
209
+ | v1.6.1 | • **Theme Configuration**: Added `MICRO_USERS_THEME` setting for easy color customization <br> • **Bug Fixes**: Explicitly excluded unwanted columns (id, ip_address, user_agent) from Activity Log table <br> • **UI**: Improved Scope Manager button visibility |
@@ -2,6 +2,10 @@
2
2
 
3
3
  [![PyPI version](https://badge.fury.io/py/micro-users.svg)](https://pypi.org/project/micro-users/)
4
4
 
5
+ <p align="center">
6
+ <img src="https://raw.githubusercontent.com/debeski/micro-users/main/users/static/img/login_logo.webp" alt="Micro Users Login Logo" width="200"/>
7
+ </p>
8
+
5
9
  **Arabic** lightweight, reusable Django app providing user management with abstract user, permissions, localization, and activity logging.
6
10
 
7
11
  ## Requirements
@@ -16,9 +20,10 @@
16
20
 
17
21
  ## Features
18
22
  - Custom AbstractUser model
19
- - User permissions system
20
- - Activity logging (login/logout, CRUD tracking)
21
- - Specific User detail and log view *new*
23
+ - Scope Management System (replaces Department)
24
+ - Custom Grouped User permissions system
25
+ - Automatic Activity logging (login/logout, CRUD for all models)
26
+ - Specific User detail and log view
22
27
  - Localization support
23
28
  - Admin interface integration
24
29
  - CRUD views and templates
@@ -45,12 +50,22 @@ INSTALLED_APPS = [
45
50
  ]
46
51
  ```
47
52
 
48
- 2. Set custom user model in settings.py:
53
+ 2. Add Middleware in `settings.py` (Required for logging):
54
+ ```python
55
+ MIDDLEWARE = [
56
+ # ...
57
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
58
+ # ...
59
+ 'users.middleware.ActivityLogMiddleware', # Add this line
60
+ ]
61
+ ```
62
+
63
+ 3. Set custom user model in `settings.py`:
49
64
  ```python
50
65
  AUTH_USER_MODEL = 'users.CustomUser'
51
66
  ```
52
67
 
53
- 3. Include URLs in your main project folder `urls.py`:
68
+ 4. Include URLs in your main project folder `urls.py`:
54
69
  ```python
55
70
  urlpatterns = [
56
71
  ...
@@ -58,7 +73,7 @@ urlpatterns = [
58
73
  ]
59
74
  ```
60
75
 
61
- 4. Run migrations:
76
+ 5. Run migrations:
62
77
  ```bash
63
78
  python manage.py migrate users
64
79
  ```
@@ -69,136 +84,18 @@ Once configured, the app automatically handles user management and activity logg
69
84
 
70
85
  ### Activity Logging
71
86
 
72
- The app automatically logs **LOGIN** and **LOGOUT** actions. For custom logging of other actions in your application, you can use the following helper functions:
73
-
74
- #### Available Helper Functions
75
-
76
- 1. **Get Client IP** - Extract the user's IP address from request:
77
- ```python
78
- from users.signals import get_client_ip
79
-
80
- # Usage in views
81
- ip_address = get_client_ip(request)
82
- ```
83
-
84
- 2. **Log User Action** - Create a reusable logging function:
85
- ```python
86
- from django.utils import timezone
87
- from users.models import UserActivityLog
88
- from users.signals import get_client_ip
89
-
90
- def log_user_action(request, instance, action, model_name):
91
- """
92
- Logs a user action to the activity log.
93
-
94
- Args:
95
- request: HttpRequest object
96
- instance: The model instance being acted upon
97
- action: Action type (see ACTION_TYPES below)
98
- model_name: Name of the model/entity (in Arabic or English)
99
- """
100
- UserActivityLog.objects.create(
101
- user=request.user,
102
- action=action,
103
- model_name=model_name,
104
- object_id=instance.pk,
105
- number=instance.number if hasattr(instance, 'number') else '',
106
- timestamp=timezone.now(),
107
- ip_address=get_client_ip(request),
108
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
109
- )
110
- ```
111
-
112
- #### Action Types Available
113
- Use these constants when logging actions:
114
-
115
- | Action Constant | Arabic Display | Description |
116
- |-----------------|----------------|-------------|
117
- | `'LOGIN'` | تسجيل دخـول | User login (auto-logged) |
118
- | `'LOGOUT'` | تسجيل خـروج | User logout (auto-logged) |
119
- | `'CREATE'` | انشـاء | Object creation |
120
- | `'UPDATE'` | تعديـل | Object modification |
121
- | `'DELETE'` | حــذف | Object deletion |
122
- | `'VIEW'` | عـرض | Object viewing |
123
- | `'DOWNLOAD'` | تحميل | File download |
124
- | `'CONFIRM'` | تأكيـد | Action confirmation |
125
- | `'REJECT'` | رفــض | Action rejection |
126
- | `'RESET'` | اعادة ضبط | Password/Data reset |
127
-
128
- #### Usage Examples
129
-
130
- 1. **Logging a CREATE action**:
131
- ```python
132
- def create_document(request):
133
- # ... create logic ...
134
- document = Document.objects.create(...)
135
-
136
- # Log the action
137
- from users.models import UserActivityLog
138
- from users.signals import get_client_ip
139
-
140
- UserActivityLog.objects.create(
141
- user=request.user,
142
- action='CREATE',
143
- model_name='وثيقة',
144
- object_id=document.pk,
145
- number=document.number,
146
- ip_address=get_client_ip(request),
147
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
148
- )
149
- ```
87
+ The app provides a fully **automated** activity logging system. No manual configuration is required in your views.
150
88
 
151
- 2. **Using the helper function**:
152
- ```python
153
- # Create a helper function in your app
154
- def log_action(request, instance, action, model_name):
155
- from users.models import UserActivityLog
156
- from users.signals import get_client_ip
157
- from django.utils import timezone
158
-
159
- UserActivityLog.objects.create(
160
- user=request.user,
161
- action=action,
162
- model_name=model_name,
163
- object_id=instance.pk,
164
- number=getattr(instance, 'number', ''),
165
- timestamp=timezone.now(),
166
- ip_address=get_client_ip(request),
167
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
168
- )
169
-
170
- # Usage in views
171
- def update_order(request, order_id):
172
- order = get_object_or_404(Order, pk=order_id)
173
- # ... update logic ...
174
- log_action(request, order, 'UPDATE', 'طلب')
175
- ```
89
+ - **Login/Logout**: Automatically tracked.
90
+ - **Create/Update/Delete**: Any change to any model in your app (including `Scope` and `User`) is automatically logged via Django Signals.
91
+ - **Log content**: Tracks the user, action type, model name, object ID, and timestamp.
92
+ - *Note*: `last_login` field updates are automatically filtered out to prevent redundant "Update" logs on login.
176
93
 
177
- 3. **Logging without an instance** (for general actions):
178
- ```python
179
- def log_general_action(request, action, model_name, description=''):
180
- from users.models import UserActivityLog
181
- from users.signals import get_client_ip
182
- from django.utils import timezone
183
-
184
- UserActivityLog.objects.create(
185
- user=request.user,
186
- action=action,
187
- model_name=model_name,
188
- object_id=None,
189
- number=description,
190
- timestamp=timezone.now(),
191
- ip_address=get_client_ip(request),
192
- user_agent=request.META.get("HTTP_USER_AGENT", ""),
193
- )
194
-
195
- # Usage
196
- log_general_action(request, 'CONFIRM', 'نظام', 'تم تأكيد الإعدادات')
197
- ```
94
+ To view logs, navigate to `manage/logs/` or use the Django Admin interface ("حركات السجل").
198
95
 
199
96
  ## Available URLs
200
97
 
201
- All user management URLs are prefixed with `manage/` as configured. Below is the complete list:
98
+ All user management URLs are prefixed with `manage/` as configured above. Below is the complete list:
202
99
 
203
100
  | URL Pattern | View/Function | Description |
204
101
  |-------------|---------------|-------------|
@@ -213,6 +110,7 @@ All user management URLs are prefixed with `manage/` as configured. Below is the
213
110
  | `manage/profile/edit/` | `views.edit_profile` | Edit current profile |
214
111
  | `manage/logs/` | `views.UserActivityLogView.as_view()` | View activity logs |
215
112
  | `manage/reset_password/<int:pk>/` | `views.reset_password` | Reset user password |
113
+ | `manage/scopes/manage/` | `views.manage_scopes` | Scope Manager (Modal) |
216
114
 
217
115
  ## Structure
218
116
  ```
@@ -221,17 +119,39 @@ users/
221
119
  ├── urls.py # URL routing
222
120
  ├── tables.py # User and Activity Log tables
223
121
  ├── signals.py # Logging signals
122
+ ├── middleware.py # Request capture for signals
224
123
  ├── models.py # User model, permissions, activity logs
225
124
  ├── forms.py # Creation, edit,. etc.
226
125
  ├── filter.py # Search filters
227
126
  ├── apps.py # Permissions Localization
228
127
  ├── admin.py # Admin UI integration
229
128
  ├── __init__.py # Python init
230
- ├── templates/ # HTML templates
129
+ ├── templates/ # HTML templates (includes partials)
231
130
  ├── static/ # CSS classes
232
131
  └── migrations/ # Database migrations
233
132
  ```
234
133
 
134
+ ## Customization
135
+
136
+ ### Replacing Login Logo
137
+ To replace the default login logo, simply place your own `login_logo.webp` image in your project's static directory at `static/img/login_logo.webp`.
138
+
139
+ ### Theme Configuration
140
+ You can configure the login page colors by defining `MICRO_USERS_THEME` in your project's `settings.py`. This dictionary overrides the default CSS variables.
141
+
142
+ ```python
143
+ MICRO_USERS_THEME = {
144
+ 'right_bg': '#474745',
145
+ 'left_bg': 'white',
146
+ 'selection_bg': '#dbdbdb',
147
+ 'gradient_start': '#a2a2a7',
148
+ 'gradient_end': '#474745',
149
+ # Additional keys supported:
150
+ # 'selection_moz_bg', 'left_shadow', 'right_shadow', 'right_text',
151
+ # 'label_color', 'input_text', 'submit_color', 'submit_focus', 'submit_active'
152
+ }
153
+ ```
154
+
235
155
  ## Version History
236
156
 
237
157
  | Version | Changes |
@@ -251,4 +171,7 @@ users/
251
171
  | v1.3.1 | • Corrected a misplaced code that caused a crash when editing profile |
252
172
  | v1.3.2 | • Minor table modifications |
253
173
  | v1.4.0 | • Redesigned Permissions UI (Grouped by App/Action) <br> • Added Global Bulk Permission Selectors <br> • Improved Arabic Localization for Permissions <br> • Optimized printing (hidden forms/buttons) <br> • Fixed various bugs and crashes |
254
- | v1.4.1 | • Changed "Administrative User" translation to "Responsible User" (مستخدم مسؤول) <br> • Enforced custom sorting order for Permissions (View -> Add -> Change -> Other) |
174
+ | v1.4.1 | • Changed "Administrative User" translation to "Responsible User" (مستخدم مسؤول) <br> • Enforced custom sorting order for Permissions (View -> Add -> Change -> Other) |
175
+ | v1.5.0 | • Department Management (Modal-based CRUD)<br> • Department field implementation<br> • Template refactoring (partials/, profile/, users/ for logs)<br> • Verbose names for models |
176
+ | v1.6.0 | • **Automated Activity Logging**: dynamic logging for all CREATE/UPDATE/DELETE actions via Middleware & Signals<br> • **Refactor**: Renamed `Department` model to `Scope` (Scope Management)<br> • Removed manual logging requirement<br> • **Architecture**: Decoupled models, forms, and tables using dynamic imports and `apps.get_model` <br> • **Soft Delete**: Users are now marked as inactive with a timestamp instead of being permanently deleted<br> • **Activity Log**: Deleted users appear with a strikethrough<br> • **CSS Refactor**: Extracted and cleaned up styling with CSS variables<br> • **Login**: Refactored login page with separated JS/CSS and a new modern default logo |
177
+ | v1.6.1 | • **Theme Configuration**: Added `MICRO_USERS_THEME` setting for easy color customization <br> • **Bug Fixes**: Explicitly excluded unwanted columns (id, ip_address, user_agent) from Activity Log table <br> • **UI**: Improved Scope Manager button visibility |