def GetIpWhitelist(): """Returns a list of IP address strings in the whitelist.""" return stored_object.Get(IP_WHITELIST_KEY)
def _GetBisectConfig(job): bisect_fyi_configs = stored_object.Get(_BISECT_FYI_CONFIGS_KEY) for test_name, config in bisect_fyi_configs.iteritems(): if job.job_name == test_name: return config return {}
def IsInternalUser(): """Checks whether the user should be able to see internal-only data.""" user = users.get_current_user() domain = stored_object.Get(INTERNAL_DOMAIN_KEY) return user and domain and user.email().endswith('@' + domain)
def IsValidSheriffUser(): """Checks whether the user should be allowed to triage alerts.""" user = users.get_current_user() sheriff_domains = stored_object.Get(SHERIFF_DOMAINS_KEY) return user and sheriff_domains and any(user.email().endswith('@' + domain) for domain in sheriff_domains)
def FetchCachedTestSuites(): """Fetches cached test suite data.""" return stored_object.Get(_NamespaceKey(_LIST_SUITES_CACHE_KEY))
def testDelete_BothVersionsDeleted(self): stored_object.Set('internal_only__foo', [1, 2, 3]) stored_object.Set('externally_visible__foo', [4, 5, 6]) namespaced_stored_object.Delete('foo') self.assertIsNone(stored_object.Get('internal_only__foo')) self.assertIsNone(stored_object.Get('externally_visible__foo'))
def testSetExternal_InternalUser_ExternalVersionSet(self): self.SetCurrentUser('*****@*****.**') namespaced_stored_object.SetExternal('foo', 12345) self.assertIsNone(stored_object.Get('internal_only__foo')) self.assertEqual(12345, stored_object.Get('externally_visible__foo'))
def Get(key): """Gets either the external or internal copy of an object.""" namespaced_key = _NamespaceKey(key) return stored_object.Get(namespaced_key)
def GetExternal(key): """Gets the external copy of a stored object.""" namespaced_key = _NamespaceKey(key, datastore_hooks.EXTERNAL) return stored_object.Get(namespaced_key)