mirror of
https://github.com/privacy-scaling-explorations/p0tion.git
synced 2026-04-21 03:00:07 -04:00
fix(security rules): adding missing authentication test utilities file
Pushing a missing file which includes test utilities related to authentication
This commit is contained in:
@@ -8,6 +8,7 @@ import { google } from "googleapis"
|
||||
import { createOAuthDeviceAuth } from "@octokit/auth-oauth-device"
|
||||
import { createUserWithEmailAndPassword, getAuth, GithubAuthProvider, UserCredential } from "firebase/auth"
|
||||
import { FirebaseApp } from "firebase/app"
|
||||
import { Auth } from "firebase-admin/lib/auth/auth"
|
||||
import { signInToFirebaseWithCredentials } from "../../src"
|
||||
import { getAuthenticationConfiguration, sleep } from "./configs"
|
||||
|
||||
@@ -497,3 +498,12 @@ export const authenticateUserWithGithub = async (userApp: FirebaseApp, clientId:
|
||||
const userFirebaseCredentials = GithubAuthProvider.credential(token)
|
||||
return signInToFirebaseWithCredentials(userApp, userFirebaseCredentials)
|
||||
}
|
||||
|
||||
/**
|
||||
* Test function to add coordinator privileges to a user.
|
||||
* @param adminAuth <Auth> - the admin auth instance.
|
||||
* @param userId <string> - the uid of the user to add the privileges to.
|
||||
*/
|
||||
export const addCoordinatorPrivileges = async (adminAuth: Auth, userId: string): Promise<void> => {
|
||||
await adminAuth.setCustomUserClaims(userId, { coordinator: true })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user