Beispiel #1
0
    def test_01_create_radius(self):
        r = add_radius(identifier="myserver",
                       server="1.2.3.4",
                       secret="testing123")
        self.assertTrue(r > 0)
        r = add_radius(identifier="myserver1",
                       server="1.2.3.4",
                       secret="testing123")
        r = add_radius(identifier="myserver2",
                       server="1.2.3.4",
                       secret="testing123")

        server_list = get_radiusservers()
        self.assertTrue(server_list)
        self.assertEqual(len(server_list), 3)
        server_list = get_radiusservers(identifier="myserver")
        self.assertTrue(server_list[0].config.identifier, "myserver")
        self.assertTrue(server_list[0].config.port, 1812)

        for server in ["myserver", "myserver1", "myserver2"]:
            r = delete_radius(server)
            self.assertTrue(r > 0)

        server_list = get_radiusservers()
        self.assertEqual(len(server_list), 0)
 def test_02_updateserver(self):
     r = add_radius(identifier="myserver", server="1.2.3.4",
                    secret="testing123")
     self.assertTrue(r > 0)
     server_list = get_radiusservers(identifier="myserver")
     self.assertTrue(server_list[0].config.server, "1.2.3.4")
     r = add_radius(identifier="myserver", server="100.2.3.4",
                    secret="testing123")
     self.assertTrue(r > 0)
     server_list = get_radiusservers(identifier="myserver")
     self.assertTrue(server_list[0].config.server, "100.2.3.4")
Beispiel #3
0
 def test_02_updateserver(self):
     r = add_radius(identifier="myserver", server="1.2.3.4",
                    secret="testing123")
     self.assertTrue(r > 0)
     server_list = get_radiusservers(identifier="myserver")
     self.assertTrue(server_list[0].config.server, "1.2.3.4")
     r = add_radius(identifier="myserver", server="100.2.3.4",
                    secret="testing123")
     self.assertTrue(r > 0)
     server_list = get_radiusservers(identifier="myserver")
     self.assertTrue(server_list[0].config.server, "100.2.3.4")
Beispiel #4
0
def list_radius():
    """
    This call gets the list of RADIUS server definitions
    """
    res = {}
    server_list = get_radiusservers()
    for server in server_list:
        # We do not add the secret!
        if g.logged_in_user.get("role") == "admin":
            res[server.config.identifier] = {
                "server": server.config.server,
                "port": server.config.port,
                "dictionary": server.config.dictionary,
                "description": server.config.description
            }
        else:
            # We do not pass any information to a normal user!
            res[server.config.identifier] = {
                "server": "",
                "port": "",
                "dictionary": "",
                "description": ""
            }

    g.audit_object.log({'success': True})
    return send_result(res)
def list_radius():
    """
    This call gets the list of RADIUS server definitions
    """
    res = {}
    server_list = get_radiusservers()
    for server in server_list:
        # We do not add the secret!
        if g.logged_in_user.get("role") == "admin":
            res[server.config.identifier] = {"server": server.config.server,
                                             "port": server.config.port,
                                             "dictionary": server.config.dictionary,
                                             "description":
                                                 server.config.description,
                                             "timeout": server.config.timeout,
                                             "retries": server.config.retries}
        else:
            # We do not pass any information to a normal user!
            res[server.config.identifier] = {"server": "",
                                             "port": "",
                                             "dictionary": "",
                                             "description": "",
                                             "timeout": 0,
                                             "retries": 0}

    g.audit_object.log({'success': True})
    return send_result(res)
    def test_01_create_radius(self):
        r = add_radius(identifier="myserver", server="1.2.3.4",
                       secret="testing123")
        self.assertTrue(r > 0)
        r = add_radius(identifier="myserver1", server="1.2.3.4",
                       secret="testing123")
        r = add_radius(identifier="myserver2", server="1.2.3.4",
                       secret="testing123")

        server_list = get_radiusservers()
        self.assertTrue(server_list)
        self.assertEqual(len(server_list), 3)
        server_list = get_radiusservers(identifier="myserver")
        self.assertTrue(server_list[0].config.identifier, "myserver")
        self.assertTrue(server_list[0].config.port, 1812)

        for server in ["myserver", "myserver1", "myserver2"]:
            r = delete_radius(server)
            self.assertTrue(r > 0)

        server_list = get_radiusservers()
        self.assertEqual(len(server_list), 0)
def list_radius():
    """
    This call gets the list of RADIUS server definitions
    """
    res = {}
    server_list = get_radiusservers()
    for server in server_list:
        # We do not add the secret!
        res[server.config.identifier] = {
            "server": server.config.server,
            "port": server.config.port,
            "dictionary": server.config.dictionary,
            "description": server.config.description,
            "timeout": server.config.timeout,
            "retries": server.config.retries
        }
    g.audit_object.log({'success': True})
    return send_result(res)