access-django-user-admin 1.2.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.
Files changed (41) hide show
  1. access_django_user_admin-1.2.0/LICENSE +201 -0
  2. access_django_user_admin-1.2.0/MANIFEST.in +5 -0
  3. access_django_user_admin-1.2.0/PKG-INFO +23 -0
  4. access_django_user_admin-1.2.0/README.md +3 -0
  5. access_django_user_admin-1.2.0/pyproject.toml +27 -0
  6. access_django_user_admin-1.2.0/setup.cfg +4 -0
  7. access_django_user_admin-1.2.0/setup.py +168 -0
  8. access_django_user_admin-1.2.0/src/access_django_user_admin/__init__.py +1 -0
  9. access_django_user_admin-1.2.0/src/access_django_user_admin/access_django_user_admin_api_service/__init__.py +1 -0
  10. access_django_user_admin-1.2.0/src/access_django_user_admin/access_django_user_admin_api_service/djangouser.py +65 -0
  11. access_django_user_admin-1.2.0/src/access_django_user_admin/admin.py +0 -0
  12. access_django_user_admin-1.2.0/src/access_django_user_admin/apps.py +5 -0
  13. access_django_user_admin-1.2.0/src/access_django_user_admin/forms.py +26 -0
  14. access_django_user_admin-1.2.0/src/access_django_user_admin/models.py +4 -0
  15. access_django_user_admin-1.2.0/src/access_django_user_admin/static/__init__.py +0 -0
  16. access_django_user_admin-1.2.0/src/access_django_user_admin/static/access_django_user_admin/__init__.py +0 -0
  17. access_django_user_admin-1.2.0/src/access_django_user_admin/static/access_django_user_admin/fonts/glyphicons-halflings-regular.eot +0 -0
  18. access_django_user_admin-1.2.0/src/access_django_user_admin/static/access_django_user_admin/fonts/glyphicons-halflings-regular.svg +229 -0
  19. access_django_user_admin-1.2.0/src/access_django_user_admin/static/access_django_user_admin/fonts/glyphicons-halflings-regular.ttf +0 -0
  20. access_django_user_admin-1.2.0/src/access_django_user_admin/static/access_django_user_admin/fonts/glyphicons-halflings-regular.woff +0 -0
  21. access_django_user_admin-1.2.0/src/access_django_user_admin/static/access_django_user_admin/img/ACCS050322_ACCESS_Brand_Operations-RGB.png +0 -0
  22. access_django_user_admin-1.2.0/src/access_django_user_admin/static/access_django_user_admin/img/favicon.ico +0 -0
  23. access_django_user_admin-1.2.0/src/access_django_user_admin/static/style-serviceindex.css +308 -0
  24. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/__init__.py +0 -0
  25. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/__init__.py +0 -0
  26. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/access_django_user_admin.html +133 -0
  27. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/add_user.html +133 -0
  28. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/base_nav_full.html +86 -0
  29. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/base_nav_none.html +27 -0
  30. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/bootstrap.html +42 -0
  31. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/edit_user.html +160 -0
  32. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/logout.html +32 -0
  33. access_django_user_admin-1.2.0/src/access_django_user_admin/templates/access_django_user_admin/unprivileged.html +23 -0
  34. access_django_user_admin-1.2.0/src/access_django_user_admin/templatetags/__init__.py +0 -0
  35. access_django_user_admin-1.2.0/src/access_django_user_admin/templatetags/user_admin_tags.py +12 -0
  36. access_django_user_admin-1.2.0/src/access_django_user_admin/urls.py +17 -0
  37. access_django_user_admin-1.2.0/src/access_django_user_admin/views.py +271 -0
  38. access_django_user_admin-1.2.0/src/access_django_user_admin.egg-info/PKG-INFO +23 -0
  39. access_django_user_admin-1.2.0/src/access_django_user_admin.egg-info/SOURCES.txt +39 -0
  40. access_django_user_admin-1.2.0/src/access_django_user_admin.egg-info/dependency_links.txt +1 -0
  41. access_django_user_admin-1.2.0/src/access_django_user_admin.egg-info/top_level.txt +1 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ include src/access_django_user_admin/templates/access_django_user_admin/*.html
2
+ include src/access_django_user_admin/static/*.css
3
+ include src/access_django_user_admin/static/access_django_user_admin/img/*
4
+ include src/access_django_user_admin/static/access_django_user_admin/fonts/*
5
+ include src/access_django_user_admin/templatetags/*
@@ -0,0 +1,23 @@
1
+ Metadata-Version: 2.4
2
+ Name: access_django_user_admin
3
+ Version: 1.2.0
4
+ Summary: Django User Admin for ACCESS Django Apps
5
+ Home-page: https://github.com/pypa/sampleproject
6
+ Author: Jesse Lambertson
7
+ Author-email: Jesse Lambertson <jelambe@iu.edu>
8
+ License-Expression: Apache-2.0
9
+ Project-URL: Homepage, https://github.com/access-ci-org/Operations_ACCESS_Django_User_Admin
10
+ Project-URL: Issues, https://github.com/access-ci-org/Operations_ACCESS_Django_User_Admin/issues
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.7, <4
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Dynamic: author
17
+ Dynamic: home-page
18
+ Dynamic: license-file
19
+ Dynamic: requires-python
20
+
21
+ # ACCESS-CI Djando user admin integrated with ACCESS Allocations User API
22
+
23
+ This tool is designed to be imported into ACCESS-CI Django apps to query an API for user information then select a result for inclusion in users and social-account tables
@@ -0,0 +1,3 @@
1
+ # ACCESS-CI Djando user admin integrated with ACCESS Allocations User API
2
+
3
+ This tool is designed to be imported into ACCESS-CI Django apps to query an API for user information then select a result for inclusion in users and social-account tables
@@ -0,0 +1,27 @@
1
+ [project]
2
+ name = "access_django_user_admin"
3
+ version = "1.2.0"
4
+ authors = [
5
+ { name="Jesse Lambertson", email="jelambe@iu.edu" },
6
+ ]
7
+ description = "Django User Admin for ACCESS Django Apps"
8
+ readme = "README.md"
9
+ requires-python = ">=3.9"
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Operating System :: OS Independent",
13
+ ]
14
+
15
+ license = "APACHE-2.0"
16
+ license-files = ["LICEN[CS]E*"]
17
+
18
+
19
+ [tool.setuptools.package-data]
20
+ "access_django_user_admin" = ["templates/**/*.html", "templatetags/**/*", "static/**/*"]
21
+
22
+ [tool.setuptools]
23
+ include-package-data = true
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/access-ci-org/Operations_ACCESS_Django_User_Admin"
27
+ Issues = "https://github.com/access-ci-org/Operations_ACCESS_Django_User_Admin/issues"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,168 @@
1
+ """access_django_user_admin setup module.
2
+
3
+ See:
4
+ https://packaging.python.org/guides/distributing-packages-using-setuptools/
5
+ https://github.com/pypa/sampleproject
6
+ """
7
+
8
+ # Always prefer setuptools over distutils
9
+ from setuptools import setup, find_packages
10
+ import pathlib
11
+
12
+ here = pathlib.Path(__file__).parent.resolve()
13
+
14
+ # Get the long description from the README file
15
+ long_description = (here / "README.md").read_text(encoding="utf-8")
16
+
17
+ # Arguments marked as "Required" below must be included for upload to PyPI.
18
+ # Fields marked as "Optional" may be commented out.
19
+
20
+ setup(
21
+ # This is the name of your project. The first time you publish this
22
+ # package, this name will be registered for you. It will determine how
23
+ # users can install this project, e.g.:
24
+ #
25
+ # $ pip install sampleproject
26
+ #
27
+ # And where it will live on PyPI: https://pypi.org/project/sampleproject/
28
+ #
29
+ # There are some restrictions on what makes a valid project name
30
+ # specification here:
31
+ # https://packaging.python.org/specifications/core-metadata/#name
32
+ name="access_django_user_admin", # Required
33
+ # Versions should comply with PEP 440:
34
+ # https://www.python.org/dev/peps/pep-0440/
35
+ #
36
+ # For a discussion on single-sourcing the version across setup.py and the
37
+ # project code, see
38
+ # https://packaging.python.org/guides/single-sourcing-package-version/
39
+ version="1.2.0", # Required
40
+ # This is a one-line description or tagline of what your project does. This
41
+ # corresponds to the "Summary" metadata field:
42
+ # https://packaging.python.org/specifications/core-metadata/#summary
43
+ description="Django User Admin app to add new users by API query", # Optional
44
+ # This is an optional longer description of your project that represents
45
+ # the body of text which users will see when they visit PyPI.
46
+ #
47
+ # Often, this is the same as your README, so you can just read it in from
48
+ # that file directly (as we have already done above)
49
+ #
50
+ # This field corresponds to the "Description" metadata field:
51
+ # https://packaging.python.org/specifications/core-metadata/#description-optional
52
+ long_description=long_description, # Optional
53
+ # Denotes that our long_description is in Markdown; valid values are
54
+ # text/plain, text/x-rst, and text/markdown
55
+ #
56
+ # Optional if long_description is written in reStructuredText (rst) but
57
+ # required for plain-text or Markdown; if unspecified, "applications should
58
+ # attempt to render [the long_description] as text/x-rst; charset=UTF-8 and
59
+ # fall back to text/plain if it is not valid rst" (see link below)
60
+ #
61
+ # This field corresponds to the "Description-Content-Type" metadata field:
62
+ # https://packaging.python.org/specifications/core-metadata/#description-content-type-optional
63
+ long_description_content_type="text/markdown", # Optional (see note above)
64
+ # This should be a valid link to your project's main homepage.
65
+ #
66
+ # This field corresponds to the "Home-Page" metadata field:
67
+ # https://packaging.python.org/specifications/core-metadata/#home-page-optional
68
+ url="https://github.com/pypa/sampleproject", # Optional
69
+ # This should be your name or the name of the organization which owns the
70
+ # project.
71
+ author="Jesse Lambertson", # Optional
72
+ # This should be a valid email address corresponding to the author listed
73
+ # above.
74
+ author_email="jelambe@iu.edu", # Optional
75
+ # Classifiers help users find your project by categorizing it.
76
+ #
77
+ # For a list of valid classifiers, see https://pypi.org/classifiers/
78
+ classifiers=[ # Optional
79
+ # How mature is this project? Common values are
80
+ # 3 - Alpha
81
+ # 4 - Beta
82
+ # 5 - Production/Stable
83
+ "Development Status :: 4 - Beta",
84
+ # Indicate who your project is intended for
85
+ "Intended Audience :: Developers",
86
+ "Topic :: Software Development :: Build Tools",
87
+ # Pick your license as you wish
88
+ "License :: OSI Approved :: Apache 2.0 License",
89
+ # Specify the Python versions you support here. In particular, ensure
90
+ # that you indicate you support Python 3. These classifiers are *not*
91
+ # checked by 'pip install'. See instead 'python_requires' below.
92
+ "Programming Language :: Python :: 3",
93
+ "Programming Language :: Python :: 3.7",
94
+ "Programming Language :: Python :: 3.8",
95
+ "Programming Language :: Python :: 3.9",
96
+ "Programming Language :: Python :: 3.10",
97
+ "Programming Language :: Python :: 3 :: Only",
98
+ ],
99
+ # This field adds keywords for your project which will appear on the
100
+ # project page. What does your project relate to?
101
+ #
102
+ # Note that this is a list of additional keywords, separated
103
+ # by commas, to be used to assist searching for the distribution in a
104
+ # larger catalog.
105
+ keywords="django, useradmin, python, development", # Optional
106
+ # When your source code is in a subdirectory under the project root, e.g.
107
+ # `src/`, it is necessary to specify the `package_dir` argument.
108
+ package_dir={"": "src"}, # Optional
109
+ # You can just specify package directories manually here if your project is
110
+ # simple. Or you can use find_packages().
111
+ #
112
+ # Alternatively, if you just want to distribute a single Python file, use
113
+ # the `py_modules` argument instead as follows, which will expect a file
114
+ # called `my_module.py` to exist:
115
+ #
116
+ # py_modules=["my_module"],
117
+ #
118
+ packages=find_packages(where="src"), # Required
119
+ # Specify which Python versions you support. In contrast to the
120
+ # 'Programming Language' classifiers above, 'pip install' will check this
121
+ # and refuse to install the project if the version does not match. See
122
+ # https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
123
+ python_requires=">=3.7, <4",
124
+ # This field lists other packages that your project depends on to run.
125
+ # Any package you put here will be installed by pip when your project is
126
+ # installed, so they must be valid existing projects.
127
+ #
128
+ # For an analysis of "install_requires" vs pip's requirements files see:
129
+ # https://packaging.python.org/discussions/install-requires-vs-requirements/
130
+ install_requires=["peppercorn"], # Optional
131
+ # List additional groups of dependencies here (e.g. development
132
+ # dependencies). Users will be able to install these using the "extras"
133
+ # syntax, for example:
134
+ #
135
+ # $ pip install sampleproject[dev]
136
+ #
137
+ # Similar to `install_requires` above, these must be valid existing
138
+ # projects.
139
+ # extras_require={ # Optional
140
+ # "dev": ["check-manifest"],
141
+ # "test": ["coverage"],
142
+ # },
143
+ # If there are data files included in your packages that need to be
144
+ # installed, specify them here.
145
+ # package_data={ # Optional
146
+ # "sample": ["package_data.dat"],
147
+ # },
148
+ # Entry points. The following would provide a command called `sample` which
149
+ # executes the function `main` from this package when invoked:
150
+ # entry_points={ # Optional
151
+ # "console_scripts": [
152
+ # "sample=sample:main",
153
+ # ],
154
+ # },
155
+ # List additional URLs that are relevant to your project as a dict.
156
+ #
157
+ # This field corresponds to the "Project-URL" metadata fields:
158
+ # https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
159
+ #
160
+ # Examples listed include a pattern for specifying where the package tracks
161
+ # issues, where the source is hosted, where to say thanks to the package
162
+ # maintainers, and where to support the project financially. The key is
163
+ # what's used to render the link text on PyPI.
164
+ project_urls={
165
+ "Bug Reports": "https://github.com/access-ci-org/Operations_Django_ACCESS_Account_Admin/issues",
166
+ "Source": "https://github.com/access-ci-org/Operations_Django_ACCESS_Account_Admin",
167
+ },
168
+ )
@@ -0,0 +1 @@
1
+ default_app_config = 'access_django_user_admin.apps.Access_Django_User_AdminConfig'
@@ -0,0 +1,65 @@
1
+ import requests, sys, os
2
+
3
+ def search_users(query):
4
+ """
5
+ Search for users via the API
6
+
7
+ Args:
8
+ query (str): The search term
9
+
10
+ Returns:
11
+ list: Search results from the API
12
+ """
13
+ # Read the API key
14
+ API_KEY = os.environ.get('API_KEY')
15
+ if not API_KEY:
16
+ try:
17
+ with open('/soft/access_django_user_admin/API_KEY', "r") as key_file:
18
+ API_KEY = key_file.read().strip()
19
+ except Exception as e:
20
+ raise Exception(f"Error reading API key: {str(e)}")
21
+
22
+ # The base URL for the API
23
+ base_url = "https://allocations-api.access-ci.org/acdb/userinfo/v2/people/search"
24
+
25
+ # Query parameters
26
+ params = {"q": query}
27
+
28
+ # Set up the required headers for authentication and routing
29
+ headers = {
30
+ "XA-RESOURCE": "operations.django",
31
+ "XA-AGENT": "userinfo",
32
+ "XA-API-KEY": API_KEY
33
+ }
34
+
35
+ # Make the API request
36
+ try:
37
+ response = requests.get(base_url, params=params, headers=headers)
38
+
39
+ # Check if the request was successful
40
+ response.raise_for_status()
41
+
42
+ # Return the JSON response
43
+ return response.json()
44
+
45
+ except requests.exceptions.HTTPError as err:
46
+ raise Exception(f"HTTP Error occurred: {err}")
47
+ except requests.exceptions.ConnectionError:
48
+ raise Exception("Error connecting to the API. Please check your internet connection.")
49
+ except requests.exceptions.Timeout:
50
+ raise Exception("The request timed out. Please try again later.")
51
+ except requests.exceptions.RequestException as err:
52
+ raise Exception(f"An error occurred: {err}")
53
+ except ValueError:
54
+ raise Exception("Could not parse the JSON response.")
55
+
56
+ # This allows the script to be run directly
57
+ if __name__ == "__main__":
58
+ search_name = input("Enter the name for which you want to query: ")
59
+ try:
60
+ results = search_users(search_name)
61
+ print("\nSearch Results:")
62
+ print(results)
63
+ except Exception as e:
64
+ print(f"UNKNOWN: {str(e)}")
65
+ sys.exit(3)
@@ -0,0 +1,5 @@
1
+ from django.apps import AppConfig
2
+
3
+ class Access_Django_User_AdminConfig(AppConfig):
4
+ name = 'access_django_user_admin'
5
+ verbose_name = 'ACCESS Django User Admin'
@@ -0,0 +1,26 @@
1
+ from django import forms
2
+ from django.contrib.auth.models import User
3
+ from django.contrib.auth.password_validation import validate_password
4
+
5
+ class UserCreationForm(forms.ModelForm):
6
+ class Meta:
7
+ model = User
8
+ fields = ['username', 'first_name', 'last_name', 'email', 'is_active', 'is_staff']
9
+ widgets = {
10
+ 'username': forms.TextInput(attrs={'class': 'form-control'}),
11
+ 'first_name': forms.TextInput(attrs={'class': 'form-control'}),
12
+ 'last_name': forms.TextInput(attrs={'class': 'form-control'}),
13
+ 'email': forms.EmailInput(attrs={'class': 'form-control'}),
14
+ }
15
+
16
+ def clean_username(self):
17
+ username = self.cleaned_data.get('username')
18
+ if User.objects.filter(username=username).exists():
19
+ raise forms.ValidationError("This username is already taken.")
20
+ return username
21
+
22
+ def clean_email(self):
23
+ email = self.cleaned_data.get('email')
24
+ if email and User.objects.filter(email=email).exists():
25
+ raise forms.ValidationError("This email is already in use.")
26
+ return email
@@ -0,0 +1,4 @@
1
+ from django.db import models
2
+ from django import forms
3
+
4
+ from django.utils.safestring import mark_safe