smoothglue_django_core 1.3.0__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.
- smoothglue_django_core-1.3.0/LICENSE +11 -0
- smoothglue_django_core-1.3.0/NOTICE +12 -0
- smoothglue_django_core-1.3.0/PKG-INFO +152 -0
- smoothglue_django_core-1.3.0/README.md +115 -0
- smoothglue_django_core-1.3.0/pyproject.toml +178 -0
- smoothglue_django_core-1.3.0/smoothglue/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/__init__.py +1 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/admin.py +129 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/apps.py +6 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/auth.py +167 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/defaults.py +6 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/0001_initial.py +134 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/0002_organizationmember_platformorganization_and_more.py +150 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/0003_platformuser_organizations_and_more.py +45 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/0004_platformuser_user_image_and_more.py +36 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/0005_platformorganization_abbreviation_and_more.py +79 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/0006_alter_organizationcategory_data_and_more.py +28 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/0007_alter_organizationcategory_options.py +17 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/migrations/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/models.py +167 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/permissions.py +16 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/schema.py +18 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/serializers.py +141 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/tests/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/tests/test_admin.py +106 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/tests/test_auth.py +119 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/tests/test_models.py +68 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/tests/test_signals.py +151 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/tests/test_views.py +112 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/urls.py +25 -0
- smoothglue_django_core-1.3.0/smoothglue/authentication/views.py +89 -0
- smoothglue_django_core-1.3.0/smoothglue/core/__init__.py +1 -0
- smoothglue_django_core-1.3.0/smoothglue/core/admin.py +36 -0
- smoothglue_django_core-1.3.0/smoothglue/core/apps.py +6 -0
- smoothglue_django_core-1.3.0/smoothglue/core/field_trie.py +75 -0
- smoothglue_django_core-1.3.0/smoothglue/core/middleware.py +37 -0
- smoothglue_django_core-1.3.0/smoothglue/core/models.py +54 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/boot_django.py +28 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/djangoshell.py +10 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/lint.py +16 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/loaddata.py +11 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/loadtests.py +8 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/makemigrations.py +8 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/migrate.py +10 -0
- smoothglue_django_core-1.3.0/smoothglue/core/scripts/test_settings.py +30 -0
- smoothglue_django_core-1.3.0/smoothglue/core/serializers/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/core/serializers/abstract/__init__.py +10 -0
- smoothglue_django_core-1.3.0/smoothglue/core/serializers/abstract/_abstract.py +129 -0
- smoothglue_django_core-1.3.0/smoothglue/core/serializers/abstract/_async_abstract.py +137 -0
- smoothglue_django_core-1.3.0/smoothglue/core/serializers/app_info.py +77 -0
- smoothglue_django_core-1.3.0/smoothglue/core/serializers/dynamic.py +296 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/conftest.py +92 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_admin_coverage.py +135 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_app_info_serializers.py +84 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_dynamic.py +499 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_field_trie.py +434 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_middleware.py +81 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_serializers.py +129 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_serializers_matching_behavior.py +125 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_views.py +212 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_views_coverage.py +142 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/test_views_matching_behavior.py +114 -0
- smoothglue_django_core-1.3.0/smoothglue/core/tests/utils.py +630 -0
- smoothglue_django_core-1.3.0/smoothglue/core/urls.py +18 -0
- smoothglue_django_core-1.3.0/smoothglue/core/utils/__init__.py +6 -0
- smoothglue_django_core-1.3.0/smoothglue/core/utils/_utils.py +48 -0
- smoothglue_django_core-1.3.0/smoothglue/core/views/__init__.py +13 -0
- smoothglue_django_core-1.3.0/smoothglue/core/views/_async_views.py +100 -0
- smoothglue_django_core-1.3.0/smoothglue/core/views/_views.py +135 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/__init__.py +1 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/admin.py +54 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/apps.py +6 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/defaults.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/logging.py +46 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/migrations/0001_initial.py +97 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/migrations/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/models.py +57 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/serializers.py +54 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/tests/__init__.py +0 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/tests/test_admin.py +166 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/tests/test_logging.py +279 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/tests/test_serializers.py +205 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/tests/test_views.py +192 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/urls.py +23 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/utils.py +41 -0
- smoothglue_django_core-1.3.0/smoothglue/tracker/views.py +35 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Copyright 2020–2025, BrainGu LLC. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software is part of SmoothGlue™, a proprietary product developed by BrainGu LLC.
|
|
4
|
+
|
|
5
|
+
This software is proprietary and confidential. It may not be copied, modified, distributed,
|
|
6
|
+
or used in any form except under a valid commercial license agreement with BrainGu.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EXPRESS OR IMPLIED,
|
|
9
|
+
INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
10
|
+
|
|
11
|
+
To inquire about licensing, contact: legal@braingu.com
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
SmoothGlue™ GuC2 Backend Core
|
|
2
|
+
Copyright 2020–2025 BrainGu, LLC (https://www.braingu.com)
|
|
3
|
+
|
|
4
|
+
This product includes software developed by BrainGu, LLC as part of the SmoothGlue™ platform.
|
|
5
|
+
|
|
6
|
+
This software is proprietary and may only be used under a license agreement with BrainGu.
|
|
7
|
+
Unauthorized use, modification, or redistribution is prohibited.
|
|
8
|
+
|
|
9
|
+
This software may include third-party components licensed under separate open source terms.
|
|
10
|
+
See the dependencies section of pyproject.toml for details on third-party components.
|
|
11
|
+
|
|
12
|
+
For licensing inquiries, contact: legal@braingu.com
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: smoothglue_django_core
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: Enhance your development with SmoothGlue™, providing a user-friendly gateway to interoperable microservices for effortlessly creating complex app behaviors.
|
|
5
|
+
License: Proprietary
|
|
6
|
+
Keywords: Interoperability,API Integration,Edge Computing,Application Framework,Data-Driven Development
|
|
7
|
+
Author: BrainGu
|
|
8
|
+
Author-email: smoothglue@braingu.com
|
|
9
|
+
Maintainer: BrainGu
|
|
10
|
+
Maintainer-email: info@braingu.com
|
|
11
|
+
Requires-Python: >=3.12,<4.0
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Framework :: Django :: 5.2
|
|
14
|
+
Classifier: Framework :: Django
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Requires-Dist: Django (>=4.2.0,<6.0.0)
|
|
23
|
+
Requires-Dist: PyJWT (>=2.10.1,<3.0.0)
|
|
24
|
+
Requires-Dist: adrf (>=0.1.9,<1.0.0)
|
|
25
|
+
Requires-Dist: coverage[toml] (==7.9.2)
|
|
26
|
+
Requires-Dist: django-cors-headers (>=4.6.0,<5.0.0)
|
|
27
|
+
Requires-Dist: django-filter (>=25.1,<26.0)
|
|
28
|
+
Requires-Dist: django-json-widget (>=2.0.1,<3.0.0)
|
|
29
|
+
Requires-Dist: djangorestframework (>=3.15.2,<4.0.0)
|
|
30
|
+
Requires-Dist: drf-spectacular (>=0.28.0,<1.0.0)
|
|
31
|
+
Requires-Dist: pillow (>=11.1.0,<12.0.0)
|
|
32
|
+
Requires-Dist: pytest (>=8.4.0)
|
|
33
|
+
Project-URL: Homepage, https://braingu.com/solutions/smoothglue/
|
|
34
|
+
Project-URL: Issues, https://braingu.com/support
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# SmoothGlue Django Core
|
|
38
|
+
|
|
39
|
+
# Overview
|
|
40
|
+
|
|
41
|
+
SmoothGlue Django Core provides a robust foundation for creating extendable and secure application features, optimized for highly regulated environments. This project includes reusable Django apps designed to streamline development for applications requiring stringent security and compliance measures.
|
|
42
|
+
|
|
43
|
+
## Key Features
|
|
44
|
+
|
|
45
|
+
- **Abstract Models:** Includes abstract models like `AuditModel` and `TimeAuditModel` for audit trail functionality in your models.
|
|
46
|
+
- **Reusable Serializers:** A set of base serializers for consistent API development.
|
|
47
|
+
- **Custom User Model:** Extensible user model adaptable to various authentication requirements.
|
|
48
|
+
- **Environment-specific Configuration:** Designed for easy configuration in different environments (development, staging, production).
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
### Prerequisites
|
|
53
|
+
|
|
54
|
+
* Python 3.12+
|
|
55
|
+
* Django 4.2+
|
|
56
|
+
* Django REST Framework 3.15.2+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Install SmoothGlue Django Core From PyPI (Official Use)
|
|
60
|
+
|
|
61
|
+
1. Use pip and the following command inside the Django project:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
pip install smoothglue_django_core
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
2. Enable Smoothglue Django Core's apps in your settings.py:
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
INSTALLED_APPS = [
|
|
73
|
+
# ... other installed apps ...
|
|
74
|
+
'smoothglue.core',
|
|
75
|
+
'smoothglue.authentication',
|
|
76
|
+
'smoothglue.tracker',
|
|
77
|
+
# ... other installed apps ...
|
|
78
|
+
]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. **Database Migrations:**
|
|
82
|
+
|
|
83
|
+
Run the migrations to create the necessary database tables:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
python manage.py migrate
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
4. Run the development server to confirm the project continues to work.
|
|
90
|
+
|
|
91
|
+
## API Usage
|
|
92
|
+
|
|
93
|
+
This package exposes several API endpoints to manage users, organizations, and other related data.
|
|
94
|
+
|
|
95
|
+
### Authentication
|
|
96
|
+
This package uses JWT-based authentication. The JWT is decoded from the Authorization or Jwt header of the request. In a development environment, ENABLE_SINGLE_USER_MODE can be set to `True` to bypass JWT authentication and use a default "UnknownUser".
|
|
97
|
+
|
|
98
|
+
### Endpoints
|
|
99
|
+
|
|
100
|
+
#### Users
|
|
101
|
+
- `GET /users/`: Retrieves a list of all users.
|
|
102
|
+
|
|
103
|
+
- `POST /users/`: Creates a new user.
|
|
104
|
+
|
|
105
|
+
- `GET /users/{id}/`: Retrieves a specific user by their ID.
|
|
106
|
+
|
|
107
|
+
- `PUT /users/{id}/`: Updates a specific user.
|
|
108
|
+
|
|
109
|
+
- `PATCH /users/{id}/`: Partially updates a user.
|
|
110
|
+
|
|
111
|
+
- `DELETE /users/{id}/`: Deletes a user.
|
|
112
|
+
|
|
113
|
+
#### Organizations
|
|
114
|
+
|
|
115
|
+
- `GET /organizations/`: Retrieves a list of all organizations.
|
|
116
|
+
|
|
117
|
+
- `POST /organizations/`: Creates a new organization.
|
|
118
|
+
|
|
119
|
+
- `GET /organizations/{id}/`: Retrieves a specific organization by its ID.
|
|
120
|
+
|
|
121
|
+
- `PUT /organizations/{id}/`: Updates an organization.
|
|
122
|
+
|
|
123
|
+
- `PATCH /organizations/{id}/`: Partially updates an organization.
|
|
124
|
+
|
|
125
|
+
- `DELETE /organizations/{id}/`: Deletes an organization.
|
|
126
|
+
|
|
127
|
+
#### Organization Members
|
|
128
|
+
|
|
129
|
+
- `GET /org-members/`: Retrieves a list of all organization members.
|
|
130
|
+
|
|
131
|
+
#### Organization Categories
|
|
132
|
+
|
|
133
|
+
- `GET /org-categories/`: Retrieves a list of all organization categories.
|
|
134
|
+
|
|
135
|
+
- `POST /org-categories/`: Creates a new organization category.
|
|
136
|
+
|
|
137
|
+
- `GET /org-categories/{id}/`: Retrieves a specific organization category by its ID.
|
|
138
|
+
|
|
139
|
+
- `PUT /org-categories/{id}/`: Updates an organization category.
|
|
140
|
+
|
|
141
|
+
- `PATCH /org-categories/{id}/`: Partially updates an organization category.
|
|
142
|
+
|
|
143
|
+
- `DELETE /org-categories/{id}/`: Deletes an organization category.
|
|
144
|
+
|
|
145
|
+
#### Active User
|
|
146
|
+
|
|
147
|
+
- `GET /active_user/`: Retrieves the currently authenticated user's information.
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
This project is licensed under a Proprietary License. See the [LICENSE](./LICENSE) file for more details.
|
|
152
|
+
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# SmoothGlue Django Core
|
|
2
|
+
|
|
3
|
+
# Overview
|
|
4
|
+
|
|
5
|
+
SmoothGlue Django Core provides a robust foundation for creating extendable and secure application features, optimized for highly regulated environments. This project includes reusable Django apps designed to streamline development for applications requiring stringent security and compliance measures.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **Abstract Models:** Includes abstract models like `AuditModel` and `TimeAuditModel` for audit trail functionality in your models.
|
|
10
|
+
- **Reusable Serializers:** A set of base serializers for consistent API development.
|
|
11
|
+
- **Custom User Model:** Extensible user model adaptable to various authentication requirements.
|
|
12
|
+
- **Environment-specific Configuration:** Designed for easy configuration in different environments (development, staging, production).
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
### Prerequisites
|
|
17
|
+
|
|
18
|
+
* Python 3.12+
|
|
19
|
+
* Django 4.2+
|
|
20
|
+
* Django REST Framework 3.15.2+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Install SmoothGlue Django Core From PyPI (Official Use)
|
|
24
|
+
|
|
25
|
+
1. Use pip and the following command inside the Django project:
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
pip install smoothglue_django_core
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
2. Enable Smoothglue Django Core's apps in your settings.py:
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
INSTALLED_APPS = [
|
|
37
|
+
# ... other installed apps ...
|
|
38
|
+
'smoothglue.core',
|
|
39
|
+
'smoothglue.authentication',
|
|
40
|
+
'smoothglue.tracker',
|
|
41
|
+
# ... other installed apps ...
|
|
42
|
+
]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
3. **Database Migrations:**
|
|
46
|
+
|
|
47
|
+
Run the migrations to create the necessary database tables:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python manage.py migrate
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
4. Run the development server to confirm the project continues to work.
|
|
54
|
+
|
|
55
|
+
## API Usage
|
|
56
|
+
|
|
57
|
+
This package exposes several API endpoints to manage users, organizations, and other related data.
|
|
58
|
+
|
|
59
|
+
### Authentication
|
|
60
|
+
This package uses JWT-based authentication. The JWT is decoded from the Authorization or Jwt header of the request. In a development environment, ENABLE_SINGLE_USER_MODE can be set to `True` to bypass JWT authentication and use a default "UnknownUser".
|
|
61
|
+
|
|
62
|
+
### Endpoints
|
|
63
|
+
|
|
64
|
+
#### Users
|
|
65
|
+
- `GET /users/`: Retrieves a list of all users.
|
|
66
|
+
|
|
67
|
+
- `POST /users/`: Creates a new user.
|
|
68
|
+
|
|
69
|
+
- `GET /users/{id}/`: Retrieves a specific user by their ID.
|
|
70
|
+
|
|
71
|
+
- `PUT /users/{id}/`: Updates a specific user.
|
|
72
|
+
|
|
73
|
+
- `PATCH /users/{id}/`: Partially updates a user.
|
|
74
|
+
|
|
75
|
+
- `DELETE /users/{id}/`: Deletes a user.
|
|
76
|
+
|
|
77
|
+
#### Organizations
|
|
78
|
+
|
|
79
|
+
- `GET /organizations/`: Retrieves a list of all organizations.
|
|
80
|
+
|
|
81
|
+
- `POST /organizations/`: Creates a new organization.
|
|
82
|
+
|
|
83
|
+
- `GET /organizations/{id}/`: Retrieves a specific organization by its ID.
|
|
84
|
+
|
|
85
|
+
- `PUT /organizations/{id}/`: Updates an organization.
|
|
86
|
+
|
|
87
|
+
- `PATCH /organizations/{id}/`: Partially updates an organization.
|
|
88
|
+
|
|
89
|
+
- `DELETE /organizations/{id}/`: Deletes an organization.
|
|
90
|
+
|
|
91
|
+
#### Organization Members
|
|
92
|
+
|
|
93
|
+
- `GET /org-members/`: Retrieves a list of all organization members.
|
|
94
|
+
|
|
95
|
+
#### Organization Categories
|
|
96
|
+
|
|
97
|
+
- `GET /org-categories/`: Retrieves a list of all organization categories.
|
|
98
|
+
|
|
99
|
+
- `POST /org-categories/`: Creates a new organization category.
|
|
100
|
+
|
|
101
|
+
- `GET /org-categories/{id}/`: Retrieves a specific organization category by its ID.
|
|
102
|
+
|
|
103
|
+
- `PUT /org-categories/{id}/`: Updates an organization category.
|
|
104
|
+
|
|
105
|
+
- `PATCH /org-categories/{id}/`: Partially updates an organization category.
|
|
106
|
+
|
|
107
|
+
- `DELETE /org-categories/{id}/`: Deletes an organization category.
|
|
108
|
+
|
|
109
|
+
#### Active User
|
|
110
|
+
|
|
111
|
+
- `GET /active_user/`: Retrieves the currently authenticated user's information.
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
This project is licensed under a Proprietary License. See the [LICENSE](./LICENSE) file for more details.
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["poetry-core"]
|
|
3
|
+
build-backend = "poetry.core.masonry.api"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "smoothglue_django_core"
|
|
7
|
+
version = "1.3.0"
|
|
8
|
+
description = "Enhance your development with SmoothGlue™, providing a user-friendly gateway to interoperable microservices for effortlessly creating complex app behaviors."
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "BrainGu", email = "smoothglue@braingu.com"}
|
|
11
|
+
]
|
|
12
|
+
maintainers = [
|
|
13
|
+
{name = "BrainGu", email = "info@braingu.com"}
|
|
14
|
+
]
|
|
15
|
+
license = {text = "Proprietary"}
|
|
16
|
+
readme = "README.md"
|
|
17
|
+
requires-python = ">=3.12,<4.0"
|
|
18
|
+
keywords = [
|
|
19
|
+
"Interoperability",
|
|
20
|
+
"API Integration",
|
|
21
|
+
"Edge Computing",
|
|
22
|
+
"Application Framework",
|
|
23
|
+
"Data-Driven Development"
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 5 - Production/Stable",
|
|
27
|
+
"Framework :: Django :: 5.2",
|
|
28
|
+
"Framework :: Django",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"Topic :: Software Development :: Libraries",
|
|
31
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
32
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Operating System :: OS Independent"
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"django-cors-headers>=4.6.0,<5.0.0",
|
|
39
|
+
"Django>=4.2.0,<6.0.0",
|
|
40
|
+
"djangorestframework>=3.15.2,<4.0.0",
|
|
41
|
+
"django-filter>=25.1,<26.0",
|
|
42
|
+
"django-json-widget>=2.0.1,<3.0.0",
|
|
43
|
+
"drf-spectacular>=0.28.0,<1.0.0",
|
|
44
|
+
"PyJWT>=2.10.1,<3.0.0",
|
|
45
|
+
"pillow>=11.1.0,<12.0.0",
|
|
46
|
+
"adrf>=0.1.9,<1.0.0",
|
|
47
|
+
"coverage[toml]==7.9.2",
|
|
48
|
+
"pytest>=8.4.0"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.urls]
|
|
52
|
+
Homepage = "https://braingu.com/solutions/smoothglue/"
|
|
53
|
+
Issues = "https://braingu.com/support"
|
|
54
|
+
|
|
55
|
+
[project.scripts]
|
|
56
|
+
pylint = "smoothglue.core.scripts.lint:_run_pylint"
|
|
57
|
+
|
|
58
|
+
[tool.poetry]
|
|
59
|
+
packages = [
|
|
60
|
+
{ include = "smoothglue" },
|
|
61
|
+
]
|
|
62
|
+
name = "smoothglue_django_core"
|
|
63
|
+
version = "1.3.0"
|
|
64
|
+
description = "Enhance your development with SmoothGlue™, providing a user-friendly gateway to interoperable microservices for effortlessly creating complex app behaviors."
|
|
65
|
+
authors = ["BrainGu"]
|
|
66
|
+
|
|
67
|
+
[tool.poetry.dependencies]
|
|
68
|
+
python = ">=3.12,<4.0"
|
|
69
|
+
|
|
70
|
+
[tool.poetry.requires-plugins]
|
|
71
|
+
poetry-plugin-export = ">=1.8"
|
|
72
|
+
|
|
73
|
+
[tool.poetry.group.dev.dependencies]
|
|
74
|
+
coverage = { extras = ["toml"], version = "^7.9.0" }
|
|
75
|
+
pylint-django = "^2.6.1"
|
|
76
|
+
flake8 = "^7.2.0"
|
|
77
|
+
ipython = "^8.30.0"
|
|
78
|
+
pre-commit = "^4.2.0"
|
|
79
|
+
black = "^25.1.0"
|
|
80
|
+
isort = "^5.13.2"
|
|
81
|
+
pylint = "^3.3.7"
|
|
82
|
+
pytest = "^8.4.0"
|
|
83
|
+
pytest-django = "^4.9.0"
|
|
84
|
+
pytest-asyncio = "^0.24.0"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
[tool.black]
|
|
89
|
+
exclude = '''
|
|
90
|
+
/(
|
|
91
|
+
.cache
|
|
92
|
+
| venv
|
|
93
|
+
| smoothglue/authentication/migrations
|
|
94
|
+
)/
|
|
95
|
+
'''
|
|
96
|
+
|
|
97
|
+
[tool.pylint.main]
|
|
98
|
+
recursive = true
|
|
99
|
+
fail-under = 10
|
|
100
|
+
max-attributes = 15
|
|
101
|
+
ignore-paths = [
|
|
102
|
+
"^.*\\.cache\\/.*$",
|
|
103
|
+
"^.*python_packages\\/.*$",
|
|
104
|
+
"^.*resources\\/.*$",
|
|
105
|
+
"^.*tests\\/.*$",
|
|
106
|
+
"^.*migrations\\/.*$",
|
|
107
|
+
"^.*venv\\/.*$"
|
|
108
|
+
]
|
|
109
|
+
ignore = ["venv", ".vscode", ".cache"]
|
|
110
|
+
no-docstring-rgx = "(?:^_|^[Tt]est.+|Mock.+)"
|
|
111
|
+
load-plugins = ["pylint_django"]
|
|
112
|
+
django-settings-module = "smoothglue.core.scripts.test_settings"
|
|
113
|
+
extension-pkg-whitelist = ["math", "_datetime"]
|
|
114
|
+
|
|
115
|
+
[tool.pylint."messages control"]
|
|
116
|
+
disable = [
|
|
117
|
+
"missing-module-docstring",
|
|
118
|
+
"E5110",
|
|
119
|
+
"W0511",
|
|
120
|
+
"E0012",
|
|
121
|
+
"E1101",
|
|
122
|
+
"C0330",
|
|
123
|
+
"C0209",
|
|
124
|
+
"C0201",
|
|
125
|
+
"C0103",
|
|
126
|
+
"R0903",
|
|
127
|
+
"W0718",
|
|
128
|
+
"C0114",
|
|
129
|
+
"C0115",
|
|
130
|
+
"C0116",
|
|
131
|
+
"W0613",
|
|
132
|
+
"W0212",
|
|
133
|
+
"R1725z",
|
|
134
|
+
"missing-docstring",
|
|
135
|
+
"duplicate-code",
|
|
136
|
+
"invalid-name",
|
|
137
|
+
"pointless-string-statement"
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
[tool.pylint.design]
|
|
141
|
+
max-parents = 15
|
|
142
|
+
exclude-too-few-public-methods = ["abc.ABC"]
|
|
143
|
+
|
|
144
|
+
[tool.pylint.typecheck]
|
|
145
|
+
ignored-classes = ["Client", "WSGIRequest"]
|
|
146
|
+
|
|
147
|
+
[tool.pylint.format]
|
|
148
|
+
max-line-length = 100
|
|
149
|
+
|
|
150
|
+
[tool.pylint.reports]
|
|
151
|
+
output-format = "colorized"
|
|
152
|
+
reports = false
|
|
153
|
+
score = true
|
|
154
|
+
|
|
155
|
+
[tool.isort]
|
|
156
|
+
profile = "black"
|
|
157
|
+
skip_glob = ["venv/**", "smoothglue/authentication/migrations/*"]
|
|
158
|
+
|
|
159
|
+
[tool.coverage.run]
|
|
160
|
+
include = [
|
|
161
|
+
"smoothglue/*",
|
|
162
|
+
]
|
|
163
|
+
command_line = "smoothglue/core/scripts/loadtests.py"
|
|
164
|
+
|
|
165
|
+
[tool.coverage.report]
|
|
166
|
+
exclude_also = [
|
|
167
|
+
# ignore abstract base classes
|
|
168
|
+
"class .+\\((?:abc\\.)?ABC\\)",
|
|
169
|
+
]
|
|
170
|
+
|
|
171
|
+
[tool.pytest.ini_options]
|
|
172
|
+
python_files = ["test_*.py"]
|
|
173
|
+
addopts = "-ra -s"
|
|
174
|
+
|
|
175
|
+
[tool.setuptools]
|
|
176
|
+
packages = ["smoothglue.core", "smoothglue.authentication", "smoothglue.authentication.migrations", "smoothglue.tracker", "smoothglue.tracker.migrations"]
|
|
177
|
+
|
|
178
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
default_app_config = "smoothglue.authentication.apps.AuthenticationConfig"
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
from django.contrib import admin
|
|
2
|
+
from django.contrib.auth import get_user_model
|
|
3
|
+
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|
4
|
+
from django.db import models
|
|
5
|
+
from django.utils.html import format_html_join
|
|
6
|
+
from django.utils.safestring import mark_safe
|
|
7
|
+
from django_json_widget.widgets import JSONEditorWidget
|
|
8
|
+
|
|
9
|
+
from smoothglue.authentication.models import (
|
|
10
|
+
OrganizationCategory,
|
|
11
|
+
OrganizationMember,
|
|
12
|
+
PlatformOrganization,
|
|
13
|
+
)
|
|
14
|
+
from smoothglue.core.admin import BaseAuditModelAdmin
|
|
15
|
+
|
|
16
|
+
User = get_user_model()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class OrganizationMembersInline(admin.TabularInline):
|
|
20
|
+
model = OrganizationMember
|
|
21
|
+
readonly_fields = BaseAuditModelAdmin.readonly_fields
|
|
22
|
+
fk_name = "platform_user"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class UserAdmin(BaseUserAdmin):
|
|
26
|
+
"""
|
|
27
|
+
Enhanced admin view for the User model that provides additional
|
|
28
|
+
features like filtering, searching, and a custom layout for JSON fields.
|
|
29
|
+
Some fields are read-only as they can only be changed in Keycloak.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
readonly_fields = (
|
|
33
|
+
"username",
|
|
34
|
+
"email",
|
|
35
|
+
)
|
|
36
|
+
list_display = (
|
|
37
|
+
"username",
|
|
38
|
+
"email",
|
|
39
|
+
"first_name",
|
|
40
|
+
"last_name",
|
|
41
|
+
"is_staff",
|
|
42
|
+
)
|
|
43
|
+
search_fields = (
|
|
44
|
+
"username",
|
|
45
|
+
"email",
|
|
46
|
+
"first_name",
|
|
47
|
+
"last_name",
|
|
48
|
+
)
|
|
49
|
+
list_filter = (
|
|
50
|
+
"is_staff",
|
|
51
|
+
"is_superuser",
|
|
52
|
+
"is_active",
|
|
53
|
+
"groups",
|
|
54
|
+
)
|
|
55
|
+
formfield_overrides = {
|
|
56
|
+
models.JSONField: {"widget": JSONEditorWidget},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
fieldsets = (
|
|
60
|
+
(None, {"fields": ("username", "email", "password")}),
|
|
61
|
+
("Personal info", {"fields": (("first_name", "last_name"), "user_image")}),
|
|
62
|
+
(
|
|
63
|
+
"Permissions",
|
|
64
|
+
{
|
|
65
|
+
"fields": (
|
|
66
|
+
"is_active",
|
|
67
|
+
"is_staff",
|
|
68
|
+
"is_superuser",
|
|
69
|
+
"groups",
|
|
70
|
+
"user_permissions",
|
|
71
|
+
)
|
|
72
|
+
},
|
|
73
|
+
),
|
|
74
|
+
("Important dates", {"fields": ("last_login", "date_joined")}),
|
|
75
|
+
("Custom Data", {"fields": ("data",)}),
|
|
76
|
+
)
|
|
77
|
+
inlines = (OrganizationMembersInline,)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class PlatformOrganizationsInline(admin.TabularInline):
|
|
81
|
+
model = PlatformOrganization
|
|
82
|
+
readonly_fields = BaseAuditModelAdmin.readonly_fields + ("group",)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class PlatformOrganizationMembersInline(admin.TabularInline):
|
|
86
|
+
model = OrganizationMember
|
|
87
|
+
readonly_fields = BaseAuditModelAdmin.readonly_fields
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class PlatformOrganizationAdmin(BaseAuditModelAdmin):
|
|
91
|
+
model = PlatformOrganization
|
|
92
|
+
inlines = (
|
|
93
|
+
PlatformOrganizationsInline,
|
|
94
|
+
PlatformOrganizationMembersInline,
|
|
95
|
+
)
|
|
96
|
+
list_display = (
|
|
97
|
+
"name",
|
|
98
|
+
"parent_organization",
|
|
99
|
+
"org_category",
|
|
100
|
+
"abbreviation",
|
|
101
|
+
"child_organizations",
|
|
102
|
+
)
|
|
103
|
+
list_editable = ("parent_organization", "org_category", "abbreviation")
|
|
104
|
+
|
|
105
|
+
def child_organizations(self, obj):
|
|
106
|
+
return format_html_join(
|
|
107
|
+
mark_safe("<br>"),
|
|
108
|
+
"<a href='/admin/authentication/platformorganization/{}'>{}</>",
|
|
109
|
+
(
|
|
110
|
+
(
|
|
111
|
+
org.id,
|
|
112
|
+
org.name,
|
|
113
|
+
)
|
|
114
|
+
for org in obj.child_organizations.all()
|
|
115
|
+
),
|
|
116
|
+
) or mark_safe("-")
|
|
117
|
+
|
|
118
|
+
readonly_fields = BaseAuditModelAdmin.readonly_fields + ("group",)
|
|
119
|
+
classes = ["wide", "extrapretty"]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class OrganizationCategoryAdmin(BaseAuditModelAdmin):
|
|
123
|
+
model = OrganizationCategory
|
|
124
|
+
list_display = ("name", "description")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
admin.site.register(User, UserAdmin)
|
|
128
|
+
admin.site.register(PlatformOrganization, PlatformOrganizationAdmin)
|
|
129
|
+
admin.site.register(OrganizationCategory, OrganizationCategoryAdmin)
|