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

Unified Diff: appengine/components/components/auth/api.py

Issue 2550143003: auth_service: Add '/memberships/list' and '/memberships/check' API. (Closed)
Patch Set: add tests and more docs Created 4 years 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
« no previous file with comments | « no previous file | appengine/components/components/auth/ui/rest_api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/components/components/auth/api.py
diff --git a/appengine/components/components/auth/api.py b/appengine/components/components/auth/api.py
index ceeb3426ccd9230c303df678a58d46d6b078396d..79e38469f3e2ac0e219c95a600fa9b5885cfd651 100644
--- a/appengine/components/components/auth/api.py
+++ b/appengine/components/components/auth/api.py
@@ -332,6 +332,14 @@ class AuthDB(object):
visit_group(group_name)
return set(model.Identity.from_bytes(m) for m in listing)
+ def fetch_groups_with_member(self, ident):
+ """Returns a set of group names that have given Identity as a member.
+
+ This is expensive call, don't use it unless really necessary.
+ """
+ # TODO(vadimsh): This is currently very dumb and can probably be optimized.
+ return {g for g in self.groups if self.is_group_member(g, ident)}
+
def get_secret(self, secret_key):
"""Returns list of strings with last known values of a secret.
« no previous file with comments | « no previous file | appengine/components/components/auth/ui/rest_api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698