MCPcopy Index your code
hub / github.com/diffgram/diffgram / create_project_auth

Function create_project_auth

shared/tests/test_utils/common_actions.py:19–58  ·  view source on GitHub ↗
(project, session, role = "Editor")

Source from the content-addressed store, hash-verified

17 session['user_id'] = cookie_hash
18 return session
19def create_project_auth(project, session, role = "Editor"):
20 auth = Auth_api()
21 session.add(auth)
22
23 member = Member()
24 session.add(member)
25 session.flush()
26 member.kind = "api"
27
28
29
30 member.auth_api = auth
31 auth.member_id = member.id
32
33
34 auth.permission_level = role
35 auth.project_string_id = project.project_string_id
36
37 auth.is_live = True
38
39 if auth.is_live == True:
40 auth.client_id = "LIVE__"
41 else:
42 auth.client_id = "TEST__"
43
44 auth.client_id += create_random_string(length=20)
45 auth.client_secret = create_random_string(length=60)
46
47 auth.project_id = project.id
48
49 regular_methods.commit_with_rollback(session)
50 Project_permissions.assign_project_roles(
51 session = session,
52 project = project,
53 member_id = auth.member_id,
54 role_name = role.lower(),
55 log = {}
56 )
57 regular_methods.commit_with_rollback(session)
58 return auth

Callers

nothing calls this directly

Calls 5

Auth_apiClass · 0.90
MemberClass · 0.90
assign_project_rolesMethod · 0.80
create_random_stringFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected