Esempio n. 1
0
 def update_fluidinfo(self, db, permsToSet=None, force=False,
                      restrict_to=None, verbose=False):
     permsToSet = permsToSet or ALL_NAMES
     # check owner has control permissions
     if not force:
         for name in CONTROL_NAMES:
             if hasattr(self, name):
                 self.check_owner_control(self.__dict__[name])
     entities = (u'abstract-tag', u'tag') if self.isTag else (u'namespace',)
     for entity in entities:
         for name in RAW_PERMS[entity].names:
             if name in permsToSet and (not restrict_to
                                        or name in restrict_to):
                 action = RAW_PERMS[entity].action(name)
                 if verbose:
                     db.Print(u'Setting %s %s\'s %s permission to %s '
                              u'except %s' % (entity, self.path[1:],
                                              action,
                               self.__dict__[name].policy,
                               unicode(self.__dict__[name].exceptions)))
                 err = db.set_raw_perm(entity, self.path[1:], action,
                                       self.__dict__[name].policy,
                                       self.__dict__[name].exceptions)
                 if err:
                     db.warning(cli.error_code(err))
Esempio n. 2
0
File: ls.py Progetto: njr0/fdb
    def update_fluidinfo(self, db):

        # check owner has control permissions
        for name in CONTROL_NAMES:
            if hasattr(self, name):
                if self.__dict__[name].policy == 'open':
                    assert not self.owner in self.__dict__[name].exceptions
                else:
                    assert self.owner in self.__dict__[name].exceptions

        entities = (u'abstract-tag', u'tag') if self.isTag else (u'namespace',)
        for entity in entities:
            for name in RAW_PERMS[entity].names:
                action = RAW_PERMS[entity].action(name)
                err = db.set_raw_perm(entity, self.path[1:], action,
                                      self.__dict__[name].policy,
                                      self.__dict__[name].exceptions)
                if err:
                    cli.warning(cli.error_code(err))