Skip to content

Configuration

All initial configuration, is done directly in Firebase when installing the extension. From here it can also be reconfigured, or installed multiple times for a variation of CMS instances.

Hosting

It's required for hosting to be deployed, to enable CMS access. Furthermore an alias is also recommended for domain auth whitelisting.

An alias or rewrite can be made as follows:

json
// firebase.json
{
	...
	"hosting": {
		...
		"rewrites": [
			{
				"source": "/admin/**", // Choose desired CMS path
				"function": "ext-grid-cms-server" // Function name
			}
		]
	},
	...
}

Permissions

Per default the schema will be saved in Firestore (/_CMS_/schema) and the current user will therefore need read/write access.

  • If write access is given the user will be able to extend the schema.
  • If only read access is given, the user will be able to login and manage data but not extend the schema.
  • If no access is given the user will be denied access.

An example of admin access for specific user:

js
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{col}/{doc=**} {
      allow read, write: if request.auth.token.email == 'admin@e-corp.com';
    }
  }
}

A more detailed example of full admin and editor access using Custom Claims:

js
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{col}/{doc=**} {
      allow read: if hasRole(['admin','editor']);
      allow write: if hasRole(['admin']) || (col != '_CMS_' && hasRole(['editor']));
    }
    function hasRole(roles) {
      return request.auth != null && request.auth.token.get("role", null) in roles;
    }
  }
}

Updating

All updates happen automatically via the GRID/CMS core js file.

Quite magical! ✨