Exemple #1
0
 def create_domain(self, domain_id, domain):
     domain.setdefault('enabled', True)
     domain['enabled'] = clean.domain_enabled(domain['enabled'])
     ret = self.driver.create_domain(domain_id, domain)
     if SHOULD_CACHE(ret):
         self.get_domain.set(ret, self, domain_id)
         self.get_domain_by_name.set(ret, self, ret['name'])
     return ret
Exemple #2
0
 def create_domain(self, domain_id, domain):
     domain.setdefault('enabled', True)
     domain['enabled'] = clean.domain_enabled(domain['enabled'])
     ret = self.driver.create_domain(domain_id, domain)
     if SHOULD_CACHE(ret):
         self.get_domain.set(ret, self, domain_id)
         self.get_domain_by_name.set(ret, self, ret['name'])
     return ret
Exemple #3
0
    def create_domain(self, domain_id, domain, initiator=None):
        domain.setdefault('enabled', True)
        domain['enabled'] = clean.domain_enabled(domain['enabled'])
        ret = self.driver.create_domain(domain_id, domain)

        notifications.Audit.created(self._DOMAIN, domain_id, initiator)

        if MEMOIZE.should_cache(ret):
            self.get_domain.set(ret, self, domain_id)
            self.get_domain_by_name.set(ret, self, ret['name'])
        return ret
Exemple #4
0
 def create_domain(self, domain_id, domain):
     if (not self.identity_api.multiple_domains_supported and
             domain_id != CONF.identity.default_domain_id):
         raise exception.Forbidden(_('Multiple domains are not supported'))
     domain.setdefault('enabled', True)
     domain['enabled'] = clean.domain_enabled(domain['enabled'])
     ret = self.driver.create_domain(domain_id, domain)
     if SHOULD_CACHE(ret):
         self.get_domain.set(ret, self, domain_id)
         self.get_domain_by_name.set(ret, self, ret['name'])
     return ret
Exemple #5
0
 def create_domain(self, domain_id, domain):
     if (not self.identity_api.multiple_domains_supported
             and domain_id != CONF.identity.default_domain_id):
         raise exception.Forbidden(_('Multiple domains are not supported'))
     domain.setdefault('enabled', True)
     domain['enabled'] = clean.domain_enabled(domain['enabled'])
     ret = self.driver.create_domain(domain_id, domain)
     if SHOULD_CACHE(ret):
         self.get_domain.set(ret, self, domain_id)
         self.get_domain_by_name.set(ret, self, ret['name'])
     return ret
Exemple #6
0
 def update_domain(self, domain_id, domain):
     if 'enabled' in domain:
         domain['enabled'] = clean.domain_enabled(domain['enabled'])
     ret = self.driver.update_domain(domain_id, domain)
     # disable owned users & projects when the API user specifically set
     #     enabled=False
     if not domain.get('enabled', True):
         self._disable_domain(domain_id)
     self.get_domain.invalidate(self, domain_id)
     self.get_domain_by_name.invalidate(self, ret['name'])
     return ret
Exemple #7
0
 def update_domain(self, domain_id, domain):
     original_domain = self.driver.get_domain(domain_id)
     if 'enabled' in domain:
         domain['enabled'] = clean.domain_enabled(domain['enabled'])
     ret = self.driver.update_domain(domain_id, domain)
     # disable owned users & projects when the API user specifically set
     #     enabled=False
     if not domain.get('enabled', True):
         self._disable_domain(domain_id)
     self.get_domain.invalidate(self, domain_id)
     self.get_domain_by_name.invalidate(self, original_domain['name'])
     return ret
Exemple #8
0
 def update_domain(self, domain_id, domain):
     original_domain = self.driver.get_domain(domain_id)
     if "enabled" in domain:
         domain["enabled"] = clean.domain_enabled(domain["enabled"])
     ret = self.driver.update_domain(domain_id, domain)
     # disable owned users & projects when the API user specifically set
     #     enabled=False
     if not domain.get("enabled", True):
         self._disable_domain(domain_id)
     self.get_domain.invalidate(self, domain_id)
     self.get_domain_by_name.invalidate(self, original_domain["name"])
     return ret
Exemple #9
0
 def update_domain(self, domain_id, domain):
     self.assert_domain_not_federated(domain_id, domain)
     original_domain = self.driver.get_domain(domain_id)
     if 'enabled' in domain:
         domain['enabled'] = clean.domain_enabled(domain['enabled'])
     ret = self.driver.update_domain(domain_id, domain)
     # disable owned users & projects when the API user specifically set
     #     enabled=False
     if (original_domain.get('enabled', True) and
             not domain.get('enabled', True)):
         self._disable_domain(domain_id)
     self.get_domain.invalidate(self, domain_id)
     self.get_domain_by_name.invalidate(self, original_domain['name'])
     return ret
Exemple #10
0
    def update_domain(self, domain_id, domain, initiator=None):
#        self.assert_domain_not_federated(domain_id, domain)
        original_domain = self.driver.get_domain(domain_id)
        if 'enabled' in domain:
            domain['enabled'] = clean.domain_enabled(domain['enabled'])
        ret = self.driver.update_domain(domain_id, domain)
        notifications.Audit.updated(self._DOMAIN, domain_id, initiator)
        # disable owned users & projects when the API user specifically set
        #     enabled=False
        if (original_domain.get('enabled', True) and
                not domain.get('enabled', True)):
            notifications.Audit.disabled(self._DOMAIN, domain_id, initiator,
                                         public=False)

        self.get_domain.invalidate(self, domain_id)
        self.get_domain_by_name.invalidate(self, original_domain['name'])
        return ret