Skip to content

A Gradle plugin that simplifies Firebase project access management through code

License

Notifications You must be signed in to change notification settings

bhargavms/gradle-plugin-firebase-iam

Repository files navigation

Firebase IAM Gradle Plugin

Gradle Build

A Gradle plugin for managing Firebase project IAM permissions, written in Kotlin.

Features

  • Manage editor and viewer permissions for multiple Firebase projects
  • Simple DSL for defining permissions
  • Automatically applies permissions using Google Cloud Resource Manager API
  • Written in Kotlin with full Kotlin DSL support

Prerequisites

  • com.google.gms.google-services applied.
  • Appropriate permissions to modify IAM policies on the target Firebase projects
  • Authentication set up service account credentials

Installation

Add the plugin to your build script:

Kotlin DSL (build.gradle.kts)

plugins {
    id("io.github.bhargavms.firebase-iam") version "1.0.0"
}

Groovy DSL (build.gradle)

plugins {
    id 'io.github.bhargavms.firebase-iam' version '1.0.0'
}

Usage

Configure the plugin in your build file:

Kotlin DSL (build.gradle.kts)

configure<com.firebase.iam.FirebaseIamExtension> {
    project("my-project-1") {
        credentialFile = project.file("firebase-project-1.json")
        editors = listOf("[email protected]", "[email protected]")
        viewers = listOf("[email protected]", "[email protected]")
    }

    project("my-project-2") {
        credentialFile = project.file("firebase-project-2.json")
        editors = listOf("[email protected]")
        viewers = listOf("[email protected]", "[email protected]")
    }
}

Groovy DSL (build.gradle)

firebaseIam {
    project("my-project-1") {
        it.credentialFile = project.file("firebase-project-1.json")
        it.editors = ["[email protected]", "[email protected]"]
        it.viewers = ["[email protected]", "[email protected]"]
    }

    project("my-project-2") {
        it.credentialFile = project.file("firebase-project-2.json")
        it.editors = ["[email protected]"]
        it.viewers = ["[email protected]", "[email protected]"]
    }
}

Apply the IAM permissions by running:

./gradlew syncFirebasePermissions

About

A Gradle plugin that simplifies Firebase project access management through code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages