Пример #1
0
 def list(self, owner=None, channel=None, cid=None, key=None):
     kwargs = {}
     if owner:kwargs['owner'] = owner
     if channel:kwargs['channel'] = channel
     if cid:kwargs['cid'] = cid
     if key and (key in PERM_CLASS.keys()):kwargs['value'] = PERM_CLASS[key]
     r = self.find(**kwargs)
     if r[0]:
         return self._output_format(result=r[1])
     else:
         return None
Пример #2
0
 def award(self, owner, channel, key, cid=None, **kwargs):
     if key not in PERM_CLASS.keys():
         return (False, 'beyond key')
     value = PERM_CLASS[key]
     return super(PermissionAPI, self).create(owner=owner, channel=channel, cid=cid, value=value, **kwargs)