Module leapyear.admin.grants¶
Convenience functions for retrieving grants on resources.
Access Summaries¶
-
class
leapyear.admin.grants.
DatabaseAccess
(subject: Union[leapyear.admin.user.User, leapyear.admin.group.Group], database: leapyear.admin.database.Database, access: leapyear.admin.database.DatabaseAccessType)¶ Access between a subject and a database.
-
subject
: Union[leapyear.admin.user.User, leapyear.admin.group.Group]¶ Subject
-
database
: leapyear.admin.database.Database¶ Database
-
access
: leapyear.admin.database.DatabaseAccessType¶ DatabaseAccessType
-
-
class
leapyear.admin.grants.
TableAccess
(subject: Union[leapyear.admin.user.User, leapyear.admin.group.Group], table: leapyear.admin.table.Table, columns: Mapping[str, leapyear.admin.table.ColumnAccessType])¶ Access between a subject and a table.
-
subject
: Union[leapyear.admin.user.User, leapyear.admin.group.Group]¶ Subject
-
table
: leapyear.admin.table.Table¶ Table
-
Functions¶
-
leapyear.admin.grants.
all_access_on_database
(db)¶ Fetch the database access for all users or groups.
Examples
>>> db = client.databases['db'] >>> for subject, access_db, access in all_grants_on_database(db): ... assert isinstance(subject, User) or isinstance(subject, Group) ... assert access_db == db ... assert isinstance(access, DatabaseAccessType) ...
- Parameters
db (
Database
) –- Returns
- Return type
List[DatabaseAccess]
-
leapyear.admin.grants.
all_access_on_table
(table)¶ Fetch the column access for all columns in the given table for all users or groups.
Examples
>>> table = client.databases['db'].tables['table'] >>> for subject, access_table, columns in all_access_on_table(table): ... assert isinstance(subject, User) or isinstance(subject, Group) ... assert access_table == table ... for column_name, column_access in columns.items(): ... assert isinstance(column_name, str) ... assert isinstance(column_access, ColumnAccessType) ...
- Parameters
table (
Table
) –- Returns
- Return type
List[TableAccess]
-
leapyear.admin.grants.
all_database_accesses_for_subject
(subject)¶ Fetch the access of all databases for the given subject.
Examples
>>> user = client.users['user'] >>> for subject, db, access in all_database_accesses_for_subject(user): ... assert subject == user ... assert isinstance(db, Database) ... assert isinstance(access, DatabaseAccessType) ...
- Parameters
subject (
Union
[User
,Group
]) –- Returns
- Return type
List[DatabaseAccess]