Example #1
0
 def add_uid(self, uid):
     if not checkUid(uid):
         raise FirewallError(errors.INVALID_UID, str(uid))
     if uid not in self.uids:
         self.uids.append(uid)
     else:
         raise FirewallError(errors.ALREADY_ENABLED,
                             'Uid "%s" already in whitelist' % uid)
 def add_uid(self, uid):
     if not checkUid(uid):
         raise FirewallError(errors.INVALID_UID, str(uid))
     if uid not in self.uids:
         self.uids.append(uid)
     else:
         raise FirewallError(errors.ALREADY_ENABLED,
                             'Uid "%s" already in whitelist' % uid)
Example #3
0
 def _check_config(self, config, item, all_config):
     if item in ["commands", "contexts", "users", "uids"]:
         for x in config:
             self._check_config(x, item[:-1], all_config)
     elif item == "command":
         if not checkCommand(config):
             raise FirewallError(errors.INVALID_COMMAND, config)
     elif item == "context":
         if not checkContext(config):
             raise FirewallError(errors.INVALID_CONTEXT, config)
     elif item == "user":
         if not checkUser(config):
             raise FirewallError(errors.INVALID_USER, config)
     elif item == "uid":
         if not checkUid(config):
             raise FirewallError(errors.INVALID_UID, config)
 def _check_config(self, config, item):
     if item in [ "commands", "contexts", "users", "uids" ]:
         for x in config:
             self._check_config(x, item[:-1])
     elif item == "command":
         if not checkCommand(config):
             raise FirewallError(errors.INVALID_COMMAND, config)
     elif item == "context":
         if not checkContext(config):
             raise FirewallError(errors.INVALID_CONTEXT, config)
     elif item == "user":
         if not checkUser(config):
             raise FirewallError(errors.INVALID_USER, config)
     elif item == "uid":
         if not checkUid(config):
             raise FirewallError(errors.INVALID_UID, config)