diff --git a/README.md b/README.md
index 0b99662bf..7f7a0ebdb 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ Hermes was created and is currently maintained by HashiCorp Labs, a small team i
1. Enable the following APIs for [Google Workspace APIs](https://developers.google.com/workspace/guides/enable-apis)
- - Admin SDK API
+ - Admin SDK API (optional, if enabling Google Groups as document approvers)
- Google Docs API
- Google Drive API
- Gmail API
@@ -146,12 +146,12 @@ NOTE: when not using a Google service account, this will automatically open a br
- Create a new key (JSON type) for the service account and download it.
- Go to [Delegating domain-wide authority to the service account](https://developers.google.com/identity/protocols/oauth2/service-account#delegatingauthority) and follow the instructions to enter the OAuth scopes.
-- Add the following OAuth scopes (comma-delimited list):
+- Add the following OAuth scopes (if enabling group approvals, add `https://www.googleapis.com/auth/admin.directory.group.readonly` to the comma-delimited list):
`https://www.googleapis.com/auth/directory.readonly,https://www.googleapis.com/auth/documents,https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/gmail.send`
1. Configure the service account in the `auth` block under the `google_workspace` config block.
-More to come here...
+1. If enabling group approvals, add the `https://www.googleapis.com/auth/admin.directory.group.readonly` role to the service user configured as the `subject` in the `auth` block (from previous step).
## Architecture
diff --git a/configs/config.hcl b/configs/config.hcl
index 0f9f2630d..f2b40b5a7 100644
--- a/configs/config.hcl
+++ b/configs/config.hcl
@@ -122,8 +122,15 @@ google_workspace {
// drafts_folder contains all draft documents.
drafts_folder = "my-drafts-folder-id"
- // groups_prefix is the prefix to use when searching for Google Groups.
- // groups_prefix = "team-"
+ // group_approvals is the configuration for using Google Groups as document
+ // approvers.
+ group_approvals {
+ // enabled enables using Google Groups as document approvers.
+ enabled = false
+
+ // search_prefix is the prefix to use when searching for Google Groups.
+ // search_prefix = "team-"
+ }
// If create_doc_shortcuts is set to true, shortcuts_folder will contain an
// organized hierarchy of folders and shortcuts to published files that can be
diff --git a/internal/api/v2/groups.go b/internal/api/v2/groups.go
index 1d36c6d74..ce0bd2988 100644
--- a/internal/api/v2/groups.go
+++ b/internal/api/v2/groups.go
@@ -47,6 +47,14 @@ func GroupsHandler(srv server.Server) http.Handler {
return
}
+ // Respond with error if group approvals are not enabled.
+ if srv.Config.GoogleWorkspace.GroupApprovals == nil ||
+ !srv.Config.GoogleWorkspace.GroupApprovals.Enabled {
+ http.Error(w,
+ "Group approvals have not been enabled", http.StatusUnprocessableEntity)
+ return
+ }
+
switch r.Method {
case "POST":
// Decode request.
@@ -73,11 +81,16 @@ func GroupsHandler(srv server.Server) http.Handler {
)
// Retrieve groups with prefix, if configured.
- if srv.Config.GoogleWorkspace.GroupsPrefix != "" {
+ searchPrefix := ""
+ if srv.Config.GoogleWorkspace.GroupApprovals != nil &&
+ srv.Config.GoogleWorkspace.GroupApprovals.SearchPrefix != "" {
+ searchPrefix = srv.Config.GoogleWorkspace.GroupApprovals.SearchPrefix
+ }
+ if searchPrefix != "" {
maxNonPrefixGroups = maxGroupResults - maxPrefixGroupResults
prefixQuery := fmt.Sprintf(
- "%s%s", srv.Config.GoogleWorkspace.GroupsPrefix, query)
+ "%s%s", searchPrefix, query)
prefixGroups, err = srv.GWService.AdminDirectory.Groups.List().
Domain(srv.Config.GoogleWorkspace.Domain).
MaxResults(maxPrefixGroupResults).
diff --git a/internal/config/config.go b/internal/config/config.go
index 9144e8f48..29e3a3ced 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -219,8 +219,9 @@ type GoogleWorkspace struct {
// DraftsFolder is the folder that contains all document drafts.
DraftsFolder string `hcl:"drafts_folder"`
- // GroupsPrefix is the prefix to use when searching for Google Groups.
- GroupsPrefix string `hcl:"groups_prefix,optional"`
+ // GoogleWorkspaceGroupApprovals is the configuration for using Google Groups as
+ // document approvers.
+ GroupApprovals *GoogleWorkspaceGroupApprovals `hcl:"group_approvals,block"`
// OAuth2 is the configuration to use OAuth 2.0 to access Google Workspace
// APIs.
@@ -241,6 +242,16 @@ type GoogleWorkspace struct {
UserNotFoundEmail *GoogleWorkspaceUserNotFoundEmail `hcl:"user_not_found_email,block"`
}
+// GoogleWorkspaceGroupApprovals is the configuration for using Google Groups as
+// document approvers.
+type GoogleWorkspaceGroupApprovals struct {
+ // Enabled enables using Google Groups as document approvers.
+ Enabled bool `hcl:"enabled,optional"`
+
+ // SearchPrefix is the prefix to use when searching for Google Groups.
+ SearchPrefix string `hcl:"search_prefix,optional"`
+}
+
// GoogleWorkspaceOAuth2 is the configuration to use OAuth 2.0 to access Google
// Workspace APIs.
type GoogleWorkspaceOAuth2 struct {
diff --git a/web/app/components/dashboard/new-features-banner.hbs b/web/app/components/dashboard/new-features-banner.hbs
index 339a81d8d..de1ebe51b 100644
--- a/web/app/components/dashboard/new-features-banner.hbs
+++ b/web/app/components/dashboard/new-features-banner.hbs
@@ -3,28 +3,39 @@
data-test-new-features-banner
@type="inline"
@color="highlight"
- @icon="folder-star"
+ {{! Icon is hidden by CSS; See `dashboard.scss` }}
@onDismiss={{this.dismiss}}
class="mb-10"
as |A|
>
- Introducing Projects!
+ What's new in Hermes
- Projects are a new way to organize documents and links around an effort.
-
-
- or
-
-
+
+ {{#if this.configSvc.config.group_approvals}}
+
+
+
+ Google Groups can be added as document approvers
+
+
+ {{/if}}
+
+
+
+ Document ownership can be transferred between users
+
+
+
+
+
+ We've improved owner filtering on the
+
+ All Docs
+
+ view
+