Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3244)

Unified Diff: appengine/logdog/coordinator/auth.go

Issue 1970823005: LogDog: Add prefix registration endpoint. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-archivist-useconfig
Patch Set: Updated patchset dependency Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/logdog/coordinator/auth.go
diff --git a/appengine/logdog/coordinator/auth.go b/appengine/logdog/coordinator/auth.go
index 6f85e80928ed24d3e9b23430b938e45206d207f3..d9fc6dc622b3a44d579dbd12c29594a9b62bb95e 100644
--- a/appengine/logdog/coordinator/auth.go
+++ b/appengine/logdog/coordinator/auth.go
@@ -45,7 +45,7 @@ func IsServiceUser(c context.Context) error {
// IsProjectReader tests whether the current user belongs to one of the
// project's declared reader groups.
//
-// If the user is not a member of any groups, a MembershipError will be
+// If the user is not a member of any of the groups, a MembershipError will be
// returned.
func IsProjectReader(c context.Context, project luciConfig.ProjectName) error {
pcfg, err := GetServices(c).ProjectConfig(c, project)
@@ -55,6 +55,19 @@ func IsProjectReader(c context.Context, project luciConfig.ProjectName) error {
return checkMember(c, pcfg.ReaderAuthGroups...)
}
+// IsProjectWriter tests whether the current user belongs to one of the
+// project's declared writer groups.
+//
+// If the user is not a member of any of the groups, a MembershipError will be
+// returned.
+func IsProjectWriter(c context.Context, project luciConfig.ProjectName) error {
+ pcfg, err := GetServices(c).ProjectConfig(c, project)
+ if err != nil {
+ return err
+ }
+ return checkMember(c, pcfg.WriterAuthGroups...)
+}
+
func checkMember(c context.Context, groups ...string) error {
// On dev-appserver, the superuser has implicit group membership to
// everything.

Powered by Google App Engine
This is Rietveld 408576698