kopia lustrzana https://github.com/newroco/mail2deck
update assignUser function
rodzic
27838db415
commit
c7eb622740
|
@ -3,6 +3,8 @@ define("NC_SERVER", "localhost"); // https://server.domain (without "https://" a
|
||||||
define("NC_HOST", "host"); //server.domain
|
define("NC_HOST", "host"); //server.domain
|
||||||
define("NC_USER", "deckbot");
|
define("NC_USER", "deckbot");
|
||||||
define("NC_PASSWORD", "****"); // if your Nextcloud instance uses Two-Factor-Authentication, use generated token here instead of password.
|
define("NC_PASSWORD", "****"); // if your Nextcloud instance uses Two-Factor-Authentication, use generated token here instead of password.
|
||||||
|
define("NC_ADMIN_USER", "admin"); // to access the nextcloud users list you need an admin
|
||||||
|
define("NC_ADMIN_PASSWORD", "admin");
|
||||||
define("MAIL_SERVER", "localhost"); // server.domain
|
define("MAIL_SERVER", "localhost"); // server.domain
|
||||||
define("MAIL_SERVER_FLAGS", "/novalidate-cert"); // flags needed to connect to server. Refer to https://www.php.net/manual/en/function.imap-open.php for a list of valid flags.
|
define("MAIL_SERVER_FLAGS", "/novalidate-cert"); // flags needed to connect to server. Refer to https://www.php.net/manual/en/function.imap-open.php for a list of valid flags.
|
||||||
define("MAIL_SERVER_PORT", "143");
|
define("MAIL_SERVER_PORT", "143");
|
||||||
|
|
|
@ -21,7 +21,7 @@ class DeckClass {
|
||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
CURLOPT_CUSTOMREQUEST => $request,
|
CURLOPT_CUSTOMREQUEST => $request,
|
||||||
CURLOPT_HTTPHEADER => array(
|
CURLOPT_HTTPHEADER => array(
|
||||||
'Authorization: Basic ' . base64_encode(NC_USER . ':' . NC_PASSWORD),
|
'Authorization: Basic ' . base64_encode(NC_ADMIN_USER . ':' . NC_ADMIN_PASSWORD),
|
||||||
'OCS-APIRequest: true',
|
'OCS-APIRequest: true',
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
@ -33,7 +33,7 @@ class DeckClass {
|
||||||
'Accept: application/json',
|
'Accept: application/json',
|
||||||
'OCS-APIRequest: true',
|
'OCS-APIRequest: true',
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
'Authorization: Basic ' . base64_encode(NC_USER . ':' . NC_PASSWORD),
|
'Authorization: Basic ' . base64_encode(NC_ADMIN_USER . ':' . NC_ADMIN_PASSWORD),
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,10 @@ class DeckClass {
|
||||||
//Assign a user to the card
|
//Assign a user to the card
|
||||||
public function assignUser($card, $mailUser)
|
public function assignUser($card, $mailUser)
|
||||||
{
|
{
|
||||||
$adminUser = urlencode(NC_USER);
|
$adminUser = urlencode(NC_ADMIN_USER);
|
||||||
$adminPassword = urlencode(NC_PASSWORD);
|
$adminPassword = urlencode(NC_ADMIN_PASSWORD);
|
||||||
|
|
||||||
$url = "http://{$adminUser}:{$adminPassword}@" . NC_HOST;
|
$url = "https://{$adminUser}:{$adminPassword}@" . NC_HOST;
|
||||||
$allUsers= $this->apiCall("GET",$url."/ocs/v1.php/cloud/users", null, false, true); //nextcloud user list
|
$allUsers= $this->apiCall("GET",$url."/ocs/v1.php/cloud/users", null, false, true); //nextcloud user list
|
||||||
|
|
||||||
foreach ($allUsers->data->users->element as $userId) {
|
foreach ($allUsers->data->users->element as $userId) {
|
||||||
|
|
Ładowanie…
Reference in New Issue