keepup-users 0.4.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.
- keepup_users-0.4.0/PKG-INFO +18 -0
- keepup_users-0.4.0/README.md +10 -0
- keepup_users-0.4.0/keepup_users/__init__.py +12 -0
- keepup_users-0.4.0/keepup_users/tables.py +83 -0
- keepup_users-0.4.0/keepup_users.egg-info/PKG-INFO +18 -0
- keepup_users-0.4.0/keepup_users.egg-info/SOURCES.txt +10 -0
- keepup_users-0.4.0/keepup_users.egg-info/dependency_links.txt +1 -0
- keepup_users-0.4.0/keepup_users.egg-info/entry_points.txt +2 -0
- keepup_users-0.4.0/keepup_users.egg-info/requires.txt +1 -0
- keepup_users-0.4.0/keepup_users.egg-info/top_level.txt +1 -0
- keepup_users-0.4.0/pyproject.toml +19 -0
- keepup_users-0.4.0/setup.cfg +4 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: keepup-users
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Accounts, the roles they hold and the rights granted.
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: keepup-db>=0.4.0
|
|
8
|
+
|
|
9
|
+
# keepup-users
|
|
10
|
+
|
|
11
|
+
Accounts, the roles they hold and the rights granted.
|
|
12
|
+
|
|
13
|
+
One capability of [keepup](https://github.com/FedorSergeev/keepup-admin), the framework over FastAPI for admin
|
|
14
|
+
panels: the base is installed as `keepup-admin` and imported as `keepup`, and
|
|
15
|
+
this distribution carries one part of it. It is installed on its own
|
|
16
|
+
(`pip install keepup-users`) or together with the base (`pip install "keepup-admin[panel]"`),
|
|
17
|
+
and it declares itself to the kernel through its
|
|
18
|
+
`[project.entry-points."keepup.plugins"]` entry point.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# keepup-users
|
|
2
|
+
|
|
3
|
+
Accounts, the roles they hold and the rights granted.
|
|
4
|
+
|
|
5
|
+
One capability of [keepup](https://github.com/FedorSergeev/keepup-admin), the framework over FastAPI for admin
|
|
6
|
+
panels: the base is installed as `keepup-admin` and imported as `keepup`, and
|
|
7
|
+
this distribution carries one part of it. It is installed on its own
|
|
8
|
+
(`pip install keepup-users`) or together with the base (`pip install "keepup-admin[panel]"`),
|
|
9
|
+
and it declares itself to the kernel through its
|
|
10
|
+
`[project.entry-points."keepup.plugins"]` entry point.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Accounts, the roles they hold and the rights granted.
|
|
2
|
+
|
|
3
|
+
This distribution provides `users` and declares one plugin,
|
|
4
|
+
`users`, in the `keepup.plugins` group. It depends on `keepup-admin`
|
|
5
|
+
for the constructor -- the descriptor, the catalogue, the service registry and
|
|
6
|
+
the lifecycle -- and on nothing of another capability.
|
|
7
|
+
|
|
8
|
+
The code moves here in keepup-124: until then the plugin lives in the framework's
|
|
9
|
+
own `builtin/users.py` and this package is the home it is moving to.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
__version__ = "0.4.0"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""The tables of the accounts, declared where the capability lives.
|
|
2
|
+
|
|
3
|
+
Task keepup-124. `keepup.schema` re-exports them for one release, so every
|
|
4
|
+
importer keeps working while the accounts capability, its module and its plugin
|
|
5
|
+
travel into this distribution; nothing that reads a user row imports the kernel
|
|
6
|
+
for it.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from sqlalchemy import Boolean, Column, DateTime, Index, Integer, Text, UniqueConstraint
|
|
10
|
+
from sqlalchemy import text as sql_text
|
|
11
|
+
|
|
12
|
+
from keepup_db import tables
|
|
13
|
+
|
|
14
|
+
__all__ = ["EXTERNAL_ROLE_MAPPINGS", "USERS", "USER_PERMISSIONS", "USER_ROLES"]
|
|
15
|
+
|
|
16
|
+
USERS = tables.table(
|
|
17
|
+
"users",
|
|
18
|
+
tables.auto_id(),
|
|
19
|
+
Column("username", Text, unique=True, nullable=False),
|
|
20
|
+
Column("password_hash", Text, nullable=False),
|
|
21
|
+
Column("status", Text, server_default="blocked"),
|
|
22
|
+
Column("role", Text, server_default="CLIENT"),
|
|
23
|
+
Column("created_at", DateTime, server_default=tables.NOW),
|
|
24
|
+
Column("external_id", Text),
|
|
25
|
+
Column("auth_source", Text, server_default="local"),
|
|
26
|
+
Column("last_external_sync", DateTime),
|
|
27
|
+
Column("email", Text),
|
|
28
|
+
Column("phone", Text),
|
|
29
|
+
Column("full_name", Text),
|
|
30
|
+
Column("updated_at", DateTime),
|
|
31
|
+
Column("agree_terms", Boolean),
|
|
32
|
+
# One external identity, one account. Partial: a local account has no
|
|
33
|
+
# external id at all, and several of those must coexist.
|
|
34
|
+
Index("users_external_identity_unique", "auth_source", "external_id", unique=True,
|
|
35
|
+
postgresql_where=sql_text("external_id IS NOT NULL"),
|
|
36
|
+
sqlite_where=sql_text("external_id IS NOT NULL")),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
USER_ROLES = tables.table(
|
|
40
|
+
"user_roles",
|
|
41
|
+
tables.auto_id(),
|
|
42
|
+
Column("user_id", Integer, nullable=False),
|
|
43
|
+
Column("role_name", Text, nullable=False),
|
|
44
|
+
Column("granted_at", DateTime, server_default=tables.NOW),
|
|
45
|
+
tables.foreign_key("user_id", "users", ("id",), ondelete="CASCADE"),
|
|
46
|
+
UniqueConstraint("user_id", "role_name", name="user_roles_user_role_unique")
|
|
47
|
+
.ddl_if(dialect="postgresql"),
|
|
48
|
+
Index("idx_user_roles_user", "user_id"),
|
|
49
|
+
Index("user_roles_user_role_unique", "user_id", "role_name",
|
|
50
|
+
unique=True).ddl_if(dialect="sqlite"),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
USER_PERMISSIONS = tables.table(
|
|
54
|
+
"user_permissions",
|
|
55
|
+
tables.auto_id(),
|
|
56
|
+
Column("user_id", Integer, nullable=False),
|
|
57
|
+
Column("permission_name", Text, nullable=False),
|
|
58
|
+
Column("granted", Boolean, server_default=sql_text("FALSE")),
|
|
59
|
+
Column("created_at", DateTime, server_default=tables.NOW),
|
|
60
|
+
Column("updated_at", DateTime, server_default=tables.NOW),
|
|
61
|
+
tables.foreign_key("user_id", "users", ("id",), ondelete="CASCADE"),
|
|
62
|
+
UniqueConstraint("user_id", "permission_name",
|
|
63
|
+
name="user_permissions_user_permission_unique").ddl_if(dialect="postgresql"),
|
|
64
|
+
Index("idx_user_permissions_user_id", "user_id"),
|
|
65
|
+
Index("idx_user_permissions_permission", "permission_name"),
|
|
66
|
+
Index("user_permissions_user_permission_unique", "user_id", "permission_name",
|
|
67
|
+
unique=True).ddl_if(dialect="sqlite"),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
EXTERNAL_ROLE_MAPPINGS = tables.table(
|
|
71
|
+
"external_role_mappings",
|
|
72
|
+
tables.auto_id(),
|
|
73
|
+
Column("external_role_name", Text, nullable=False),
|
|
74
|
+
Column("internal_permission_name", Text, nullable=False),
|
|
75
|
+
Column("auth_source", Text, nullable=False),
|
|
76
|
+
Column("created_at", DateTime, server_default=tables.NOW),
|
|
77
|
+
UniqueConstraint("external_role_name", "auth_source", "internal_permission_name",
|
|
78
|
+
name="external_role_mappings_unique").ddl_if(dialect="postgresql"),
|
|
79
|
+
Index("idx_ext_role_mappings_source", "auth_source"),
|
|
80
|
+
Index("idx_ext_role_mappings_role", "external_role_name"),
|
|
81
|
+
Index("external_role_mappings_unique", "external_role_name", "auth_source",
|
|
82
|
+
"internal_permission_name", unique=True).ddl_if(dialect="sqlite"),
|
|
83
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: keepup-users
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Accounts, the roles they hold and the rights granted.
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: keepup-db>=0.4.0
|
|
8
|
+
|
|
9
|
+
# keepup-users
|
|
10
|
+
|
|
11
|
+
Accounts, the roles they hold and the rights granted.
|
|
12
|
+
|
|
13
|
+
One capability of [keepup](https://github.com/FedorSergeev/keepup-admin), the framework over FastAPI for admin
|
|
14
|
+
panels: the base is installed as `keepup-admin` and imported as `keepup`, and
|
|
15
|
+
this distribution carries one part of it. It is installed on its own
|
|
16
|
+
(`pip install keepup-users`) or together with the base (`pip install "keepup-admin[panel]"`),
|
|
17
|
+
and it declares itself to the kernel through its
|
|
18
|
+
`[project.entry-points."keepup.plugins"]` entry point.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
keepup_users/__init__.py
|
|
4
|
+
keepup_users/tables.py
|
|
5
|
+
keepup_users.egg-info/PKG-INFO
|
|
6
|
+
keepup_users.egg-info/SOURCES.txt
|
|
7
|
+
keepup_users.egg-info/dependency_links.txt
|
|
8
|
+
keepup_users.egg-info/entry_points.txt
|
|
9
|
+
keepup_users.egg-info/requires.txt
|
|
10
|
+
keepup_users.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
keepup-db>=0.4.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
keepup_users
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "keepup-users"
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "Accounts, the roles they hold and the rights granted."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"keepup-db>=0.4.0",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
[project.entry-points."keepup.plugins"]
|
|
16
|
+
users = "keepup_users:UsersPlugin"
|
|
17
|
+
|
|
18
|
+
[tool.setuptools]
|
|
19
|
+
packages = ["keepup_users"]
|