MCPcopy
hub / github.com/learnhouse/learnhouse / install_default_elements

Function install_default_elements

apps/api/src/services/setup/setup.py:21–483  ·  view source on GitHub ↗

Upsert global default roles. Existing roles are updated in place to preserve FK references from userorganization.

(db_session: AsyncSession)

Source from the content-addressed store, hash-verified

19
20# Install Default roles
21async def install_default_elements(db_session: AsyncSession):
22 """Upsert global default roles. Existing roles are updated in place to
23 preserve FK references from userorganization."""
24
25 logger = logging.getLogger(__name__)
26
27 # Build the desired role definitions
28 role_global_admin = Role(
29 name="Admin",
30 description="Full platform control",
31 id=1,
32 role_type=RoleTypeEnum.TYPE_GLOBAL,
33 role_uuid="role_global_admin",
34 rights=Rights(
35 courses=PermissionsWithOwn(
36 action_create=True,
37 action_read=True,
38 action_read_own=True,
39 action_update=True,
40 action_update_own=True,
41 action_delete=True,
42 action_delete_own=True,
43 ),
44 users=Permission(
45 action_create=True,
46 action_read=True,
47 action_update=True,
48 action_delete=True,
49 ),
50 usergroups=Permission(
51 action_create=True,
52 action_read=True,
53 action_update=True,
54 action_delete=True,
55 ),
56 collections=Permission(
57 action_create=True,
58 action_read=True,
59 action_update=True,
60 action_delete=True,
61 ),
62 organizations=Permission(
63 action_create=True,
64 action_read=True,
65 action_update=True,
66 action_delete=True,
67 ),
68 coursechapters=Permission(
69 action_create=True,
70 action_read=True,
71 action_update=True,
72 action_delete=True,
73 ),
74 activities=Permission(
75 action_create=True,
76 action_read=True,
77 action_update=True,
78 action_delete=True,

Callers 3

_install_asyncFunction · 0.90
auto_installFunction · 0.90

Calls 8

RoleClass · 0.90
RightsClass · 0.90
PermissionsWithOwnClass · 0.90
PermissionClass · 0.90
DashboardPermissionClass · 0.90
commitMethod · 0.80
model_dumpMethod · 0.45
getMethod · 0.45