From: Tony Mack Date: Wed, 11 Mar 2009 04:01:14 +0000 (+0000) Subject: support special cases where caller is the root auth (root auth must have a registry... X-Git-Tag: sfa-0.9-0@14641~589 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=934c459d6b71b287b88e802a1a5440d3907b370c;p=sfa.git support special cases where caller is the root auth (root auth must have a registry record --- diff --git a/geni/gimport.py b/geni/gimport.py index 5a138b02..5c8f756f 100755 --- a/geni/gimport.py +++ b/geni/gimport.py @@ -319,7 +319,9 @@ def import_site(parent_hrn, site): def create_top_level_auth_records(hrn): parent_hrn = get_authority(hrn) - print hrn, ":", parent_hrn + print hrn, ":", parent_hrn + if not parent_hrn: + parent_hrn = hrn auth_info = AuthHierarchy.get_auth_info(parent_hrn) table = get_auth_table(parent_hrn) @@ -351,8 +353,7 @@ def main(): if not AuthHierarchy.auth_exists(root_auth): AuthHierarchy.create_auth(root_auth) - #create_top_level_auth_records(root_auth) - + create_top_level_auth_records(root_auth) if level1_auth: if not AuthHierarchy.auth_exists(level1_auth): AuthHierarchy.create_auth(level1_auth) diff --git a/geni/registry.py b/geni/registry.py index c39c243e..97af9600 100644 --- a/geni/registry.py +++ b/geni/registry.py @@ -557,6 +557,8 @@ class Registry(GeniServer): self.verify_object_permission(record.get_name()) auth_name = get_authority(record.get_name()) + if not auth_name: + auth_name = record.get_name() table = self.get_auth_table(auth_name) # make sure the record exists @@ -656,11 +658,10 @@ class Registry(GeniServer): def resolve_raw(self, type, name, must_exist=True): auth_name = get_authority(name) - + if not auth_name: + auth_name = name table = self.get_auth_table(auth_name) - records = table.resolve(type, name) - if (not records) and must_exist: raise RecordNotFound(name) @@ -777,8 +778,9 @@ class Registry(GeniServer): self.verify_object_belongs_to_me(name) auth_hrn = get_authority(name) + if not auth_hrn: + auth_hrn = name auth_info = self.get_auth_info(auth_hrn) - # find a record that matches records = self.resolve_raw(type, name, must_exist=True) record = records[0] @@ -824,6 +826,9 @@ class Registry(GeniServer): def verify_cancreate_credential(self, src_cred, record): type = record.get_type() cred_object_hrn = src_cred.get_gid_object().get_hrn() + config = Config() + if cred_object_hrn in [config.GENI_REGISTRY_ROOT_AUTH]: + return if type=="slice": researchers = record.get_geni_info().get("researcher", []) if not (cred_object_hrn in researchers): @@ -859,6 +864,8 @@ class Registry(GeniServer): self.verify_object_belongs_to_me(name) auth_hrn = get_authority(name) + if not auth_hrn: + auth_hrn = name auth_info = self.get_auth_info(auth_hrn) records = self.resolve_raw(type, name, must_exist=True) @@ -925,6 +932,8 @@ class Registry(GeniServer): # that they should be combined? auth_hrn = get_authority(name) + if not auth_hrn: + auth_hrn = name auth_info = self.get_auth_info(auth_hrn) records = self.resolve_raw("slice", name, must_exist=True)