(appId: string)
| 75 | } |
| 76 | |
| 77 | export async function isAuthorizedWriteForApp(appId: string) { |
| 78 | const session = await getAuthUserSession(); |
| 79 | if (UserGroupUtils.isAdmin(session)) { |
| 80 | return session; |
| 81 | } |
| 82 | if (!session.userGroup) { |
| 83 | console.error('User is not authorized for app: ' + appId); |
| 84 | throw new ServiceException('User is not authorized for this action.'); |
| 85 | } |
| 86 | const roleHasReadAccessForApp = UserGroupUtils.sessionHasWriteAccessForApp(session, appId); |
| 87 | if (!roleHasReadAccessForApp) { |
| 88 | console.error('User is not authorized for app: ' + appId); |
| 89 | throw new ServiceException('User is not authorized for this action.'); |
| 90 | } |
| 91 | return session; |
| 92 | } |
| 93 | |
| 94 | export async function safeGetUserPermissionForApp(appId: string) { |
| 95 | const session = await getUserSession(); |
no test coverage detected