Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Two options are available:

See the [admin documentation](https://docs.nextcloud.com/server/latest/admin_manual/exapps_management/DeployConfigurations.html) for setup instructions.
]]></description>
<version>35.0.0-dev.0</version>
<version>35.0.0-dev.1</version>
<licence>agpl</licence>
<author mail="andrey18106x@gmail.com" homepage="https://github.com/andrey18106">Andrey Borysenko</author>
<author mail="bigcat88@icloud.com" homepage="https://github.com/bigcat88">Alexander Piskun</author>
Expand Down
8 changes: 6 additions & 2 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,16 @@
// ExApps actions
['name' => 'OCSExApp#setExAppEnabled', 'url' => '/api/v1/ex-app/{appId}/enabled', 'verb' => 'PUT'],

// appconfig_ex (app configuration)
// ExApp app configuration (backed by the server's IAppConfig / oc_appconfig).
// Intentionally kept as AppAPI endpoints: the server's own provisioning_api app-config
// routes require admin / delegated-admin authorization, which an ExApp request lacks.
['name' => 'AppConfig#setAppConfigValue', 'url' => '/api/v1/ex-app/config', 'verb' => 'POST'],
['name' => 'AppConfig#getAppConfigValues', 'url' => '/api/v1/ex-app/config/get-values', 'verb' => 'POST'],
['name' => 'AppConfig#deleteAppConfigValues', 'url' => '/api/v1/ex-app/config', 'verb' => 'DELETE'],

// preferences_ex (user-specific configuration)
// ExApp per-user preferences (backed by the server's IUserConfig / oc_preferences).
// Intentionally kept: the server's provisioning_api user-config routes are write-only
// (no read endpoint) and have no sensitive/encrypted-value support.
['name' => 'Preferences#setUserConfigValue', 'url' => '/api/v1/ex-app/preference', 'verb' => 'POST'],
['name' => 'Preferences#getUserConfigValues', 'url' => '/api/v1/ex-app/preference/get-values', 'verb' => 'POST'],
['name' => 'Preferences#deleteUserConfigValues', 'url' => '/api/v1/ex-app/preference', 'verb' => 'DELETE'],
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/AppConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function deleteAppConfigValues(array $configKeys): DataResponse {
throw new OCSBadRequestException('Error deleting app config values');
}
if ($result === 0) {
throw new OCSNotFoundException('No appconfig_ex values deleted');
throw new OCSNotFoundException('No app config values deleted');
}
return new DataResponse($result, Http::STATUS_OK);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/PreferencesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function deleteUserConfigValues(array $configKeys): DataResponse {
throw new OCSBadRequestException('Failed to delete user config values');
}
if ($result === 0) {
throw new OCSNotFoundException('No preferences_ex values deleted');
throw new OCSNotFoundException('No user config values deleted');
}
return new DataResponse($result, Http::STATUS_OK);
}
Expand Down
92 changes: 49 additions & 43 deletions lib/Db/ExAppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,67 @@
namespace OCA\AppAPI\Db;

use JsonSerializable;
use OCP\AppFramework\Db\Entity;

/**
* Class ExAppConfig
* App configuration value object.
*
* @package OCA\AppAPI\Db
* Historically a database entity backed by the `appconfig_ex` table. ExApp config now lives
* in the server's standard `oc_appconfig` (via {@see \OCA\AppAPI\Service\ExAppConfigService});
* this class remains as a plain serializable DTO for OCS responses and internal callers.
*
* @method string getAppid()
* @method string getConfigkey()
* @method string getConfigvalue()
* @method int getSensitive()
* @method void setAppid(string $appId)
* @method void setConfigKey(string $configKey)
* @method void setConfigvalue(string $configValue)
* @method void setSensitive(int $sensitive)
* The `id` field has no surrogate key anymore (the server table uses a composite primary key);
* it is kept in the serialized shape as `0` for backwards compatibility and is unused.
*/
class ExAppConfig extends Entity implements JsonSerializable {
protected $appid;
protected $configkey;
protected $configvalue;
protected $sensitive;
class ExAppConfig implements JsonSerializable {
private int $id;
private string $appid;
private string $configkey;
private string $configvalue;
private int $sensitive;

/**
* @param array $params
*/
public function __construct(array $params = []) {
$this->addType('appid', 'string');
$this->addType('configkey', 'string');
$this->addType('configvalue', 'string');
$this->addType('sensitive', 'integer');
$this->id = isset($params['id']) ? (int)$params['id'] : 0;
$this->appid = (string)($params['appid'] ?? '');
$this->configkey = (string)($params['configkey'] ?? '');
$this->configvalue = (string)($params['configvalue'] ?? '');
$this->sensitive = (int)($params['sensitive'] ?? 0);
}

public function getId(): int {
return $this->id;
}

public function getAppid(): string {
return $this->appid;
}

public function getConfigkey(): string {
return $this->configkey;
}

public function getConfigvalue(): string {
return $this->configvalue;
}

public function setConfigvalue(string $configValue): void {
$this->configvalue = $configValue;
}

public function getSensitive(): int {
return $this->sensitive;
}

if (isset($params['id'])) {
$this->setId($params['id']);
}
if (isset($params['appid'])) {
$this->setAppid($params['appid']);
}
if (isset($params['configkey'])) {
$this->setConfigkey($params['configkey']);
}
if (isset($params['configvalue'])) {
$this->setConfigvalue($params['configvalue']);
}
if (isset($params['sensitive'])) {
$this->setSensitive($params['sensitive']);
}
public function setSensitive(int $sensitive): void {
$this->sensitive = $sensitive;
}

public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'appid' => $this->getAppid(),
'configkey' => $this->getConfigkey(),
'configvalue' => $this->getConfigvalue(),
'sensitive' => $this->getSensitive(),
'id' => $this->id,
'appid' => $this->appid,
'configkey' => $this->configkey,
'configvalue' => $this->configvalue,
'sensitive' => $this->sensitive,
];
}
}
91 changes: 0 additions & 91 deletions lib/Db/ExAppConfigMapper.php

This file was deleted.

107 changes: 56 additions & 51 deletions lib/Db/ExAppPreference.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,69 +10,74 @@
namespace OCA\AppAPI\Db;

use JsonSerializable;
use OCP\AppFramework\Db\Entity;

/**
* Class ExAppPreference
* App per-user preference value object.
*
* @package OCA\AppAPI\Db
* Historically a database entity backed by the `preferences_ex` table. ExApp preferences now
* live in the server's standard `oc_preferences` (via {@see \OCA\AppAPI\Service\ExAppPreferenceService});
* this class remains as a plain serializable DTO for OCS responses and internal callers.
*
* @method string getUserid()
* @method string getAppid()
* @method string getConfigkey()
* @method string getConfigvalue()
* @method int getSensitive()
* @method void setUserid(string $userid)
* @method void setAppid(string $appid)
* @method void setConfigkey(string $configkey)
* @method void setConfigvalue(string $configvalue)
* @method void setSensitive(int $sensitive)
* The `id` field has no surrogate key anymore (the server table uses a composite primary key);
* it is kept in the serialized shape as `0` for backwards compatibility and is unused.
*/
class ExAppPreference extends Entity implements JsonSerializable {
protected $userid;
protected $appid;
protected $configkey;
protected $configvalue;
protected $sensitive;
class ExAppPreference implements JsonSerializable {
private int $id;
private string $userid;
private string $appid;
private string $configkey;
private string $configvalue;
private int $sensitive;

/**
* @param array $params
*/
public function __construct(array $params = []) {
$this->addType('userid', 'string');
$this->addType('appid', 'string');
$this->addType('configkey', 'string');
$this->addType('configvalue', 'string');
$this->addType('sensitive', 'integer');
$this->id = isset($params['id']) ? (int)$params['id'] : 0;
$this->userid = (string)($params['userid'] ?? '');
$this->appid = (string)($params['appid'] ?? '');
$this->configkey = (string)($params['configkey'] ?? '');
$this->configvalue = (string)($params['configvalue'] ?? '');
$this->sensitive = (int)($params['sensitive'] ?? 0);
}

public function getId(): int {
return $this->id;
}

public function getUserid(): string {
return $this->userid;
}

public function getAppid(): string {
return $this->appid;
}

public function getConfigkey(): string {
return $this->configkey;
}

public function getConfigvalue(): string {
return $this->configvalue;
}

public function setConfigvalue(string $configValue): void {
$this->configvalue = $configValue;
}

public function getSensitive(): int {
return $this->sensitive;
}

if (isset($params['id'])) {
$this->setId($params['id']);
}
if (isset($params['userid'])) {
$this->setUserid($params['userid']);
}
if (isset($params['appid'])) {
$this->setAppid($params['appid']);
}
if (isset($params['configkey'])) {
$this->setConfigkey($params['configkey']);
}
if (isset($params['configvalue'])) {
$this->setConfigvalue($params['configvalue']);
}
if (isset($params['sensitive'])) {
$this->setSensitive($params['sensitive']);
}
public function setSensitive(int $sensitive): void {
$this->sensitive = $sensitive;
}

public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'user_id' => $this->getUserid(),
'appid' => $this->getAppid(),
'configkey' => $this->getConfigkey(),
'configvalue' => $this->getConfigvalue(),
'sensitive' => $this->getSensitive(),
'id' => $this->id,
'user_id' => $this->userid,
'appid' => $this->appid,
'configkey' => $this->configkey,
'configvalue' => $this->configvalue,
'sensitive' => $this->sensitive,
];
}
}
Loading
Loading