(project, session, role = "Editor")
| 17 | session['user_id'] = cookie_hash |
| 18 | return session |
| 19 | def 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 |
nothing calls this directly
no test coverage detected