Ejemplo n.º 1
0
    async def delAuthGate(self, iden):
        gate = self.getAuthGate(iden)
        if gate is None:
            raise s_exc.NoSuchAuthGate(iden=iden)

        await gate.fini()
        await gate.delete()
        await gate.node.pop()
        del self.authgates[iden]
Ejemplo n.º 2
0
    async def delAuthGate(self, iden):
        '''
        Delete AuthGate by iden.

        Note:
            Not change distributed
        '''
        gate = self.getAuthGate(iden)
        if gate is None:
            raise s_exc.NoSuchAuthGate(iden=iden)

        await gate.fini()
        await gate.delete()
        await gate.node.pop()

        del self.authgates[iden]
Ejemplo n.º 3
0
    async def getRulerByName(self, name, iden=None):
        '''
        Returns:
            the HiveRuler (a HiveUser, HiveRole, GateUser, or GateRole) corresponding to the given name.
            If iden is not None, it returns the HiveRole or HiveUser of the AuthGate with iden.
        '''
        if iden is not None:
            authgate = self.getAuthGate(iden)
            if authgate is None:
                raise s_exc.NoSuchAuthGate(iden=iden)

        user = self.getUserByName(name)
        if user is not None:
            if iden is not None:
                return await authgate.getGateUser(user)
            return user

        role = self.getRoleByName(name)
        if role is not None:
            if iden is not None:
                return await authgate.getGateRole(role)
            return role

        raise s_exc.NoSuchName(name=name)
Ejemplo n.º 4
0
 def reqAuthGate(self, iden):
     gate = self.authgates.get(iden)
     if gate is None:
         mesg = f'No auth gate found with iden: ({iden}).'
         raise s_exc.NoSuchAuthGate(iden=iden, mesg=mesg)
     return gate