Skip to content

Commit ebebf3a

Browse files
author
Alexander Birkner
committed
Update Fri Mar 11 14:44:24 CET 2016
1 parent fc0a276 commit ebebf3a

File tree

2 files changed

+44
-3
lines changed

2 files changed

+44
-3
lines changed

lib/Nitrapi/Services/ServiceCollection.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ public function __construct(Nitrapi $api, array $options = array()) {
2323
$_services = $this->getApi()->dataGet("services", null, $options);
2424
if (count($_services['services']) > 0) {
2525
foreach ($_services['services'] as $service) {
26-
$this->services[] = ServiceFactory::factory($this->getApi(), array(
27-
'id' => $service['id'],
28-
));
26+
try {
27+
$this->services[] = ServiceFactory::factory($this->getApi(), array(
28+
'id' => $service['id'],
29+
));
30+
} catch (\Exception $e) {}
2931
}
3032
}
3133
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Nitrapi\Services\Voiceservers\Types;
4+
5+
class Mumble extends Type
6+
{
7+
/**
8+
* Adds a new User
9+
*
10+
* @param string $username
11+
* @param string $password
12+
* @return string
13+
*/
14+
public function addUser($username, $password) {
15+
$url = "services/" . $this->service->getId() . "/voiceservers/mumble/user";
16+
$this->service->getApi()->dataPost($url, [
17+
'username' => $username,
18+
'password' => $password,
19+
]);
20+
21+
return true;
22+
23+
}
24+
25+
/**
26+
* Deletes a User
27+
*
28+
* @param string $username
29+
* @return string
30+
*/
31+
public function deleteUser($username) {
32+
$url = "services/" . $this->service->getId() . "/voiceservers/mumble/user";
33+
$this->service->getApi()->dataDelete($url, [
34+
'username' => $username
35+
]);
36+
37+
return true;
38+
}
39+
}

0 commit comments

Comments
 (0)