Skip to content

Commit

Permalink
feature(outlook-and-teams-settings-added)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonvandebroek committed Oct 19, 2024
1 parent a97fd6a commit 3dc1ec0
Show file tree
Hide file tree
Showing 14 changed files with 267 additions and 25 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,4 +299,9 @@

## 3.0.14 - 2024-09-16
### Fix
- Fix for users experiencing issues with Secure Mail rendering in Nextcloud running versions >= 28.x
- Fix for users experiencing issues with Secure Mail rendering in Nextcloud running versions >= 28.x

## 3.0.15 - 2024-10-19
### Features
- Added setting for controlling Presence Synchronisation (Outlook add-in)
- Added setting to configure default upload path (MS Teams add-in)
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>Sendent</name>
<summary lang="en">Sendent allows you to securely exchange files and emails</summary>
<description lang="en">Sendent now securely exchanges files and emails, integrating with both Microsoft Outlook and Microsoft Teams. This enhanced capability allows users to seamlessly conduct their work, not only within their preferred email environment but also within the collaborative framework of Microsoft Teams. Whether sharing privacy-sensitive documents, content, or handling attachments that exceed standard email size constraints, Sendent ensures a streamlined and secure communication experience. All files are directed to your Nextcloud instance, empowering you to control and manage access permissions effectively.</description>
<version>3.0.14</version>
<version>3.0.15</version>
<licence>agpl</licence>
<author mail="[email protected]" homepage="https://www.sendent.com">Sendent B.V.</author>
<namespace>Sendent</namespace>
Expand Down
2 changes: 2 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
['name' => 'setting_key_api#index', 'url' => '/api/1.0/settingkey/index', 'verb' => 'GET'],
['name' => 'setting_key_api#showByKey', 'url' => '/api/1.0/settingkey/showByKey/{key}', 'verb' => 'GET'],
['name' => 'setting_key_api#showByTemplateId', 'url' => '/api/1.0/settingkey/showByTemplateId/{templateid}', 'verb' => 'GET'],
['name' => 'setting_key_api#showByTemplateKey', 'url' => '/api/1.0/settingkey/showByTemplateKey/{templatekey}', 'verb' => 'GET'],
['name' => 'setting_key_api#showTheming', 'url' => '/api/1.0/settingkey/theming', 'verb' => 'GET'],
['name' => 'setting_key_api#create', 'url' => '/api/1.0/settingkey', 'verb' => 'POST'],
['name' => 'setting_key_api#update', 'url' => '/api/1.0/settingkey/{id}', 'verb' => 'PUT'],
Expand Down Expand Up @@ -46,6 +47,7 @@
],
['name' => 'setting_template_api#index', 'url' => '/api/1.0/settingtemplate/index', 'verb' => 'GET'],
['name' => 'setting_template_api#show', 'url' => '/api/1.0/settingtemplate/{id}', 'verb' => 'GET'],
['name' => 'setting_template_api#showByTemplateKey', 'url' => '/api/1.0/settingtemplate/bytemplatekey/{templateKey}', 'verb' => 'GET'],
['name' => 'setting_template_api#create', 'url' => '/api/1.0/settingtemplate', 'verb' => 'POST'],
['name' => 'setting_template_api#update', 'url' => '/api/1.0/settingtemplate/{id}', 'verb' => 'PUT'],
['name' => 'setting_template_api#destroy', 'url' => '/api/1.0/settingtemplate/{id}', 'verb' => 'DELETE'],
Expand Down
2 changes: 0 additions & 2 deletions lib/Controller/SettingKeyApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function showByKey(string $key) {
public function showTheming() {
return $this->service->findByTemplateId(1);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
Expand All @@ -64,7 +63,6 @@ public function showTheming() {
public function showByTemplateId(int $templateid) {
return $this->service->findByTemplateId($templateid);
}

/**
* @NoAdminRequired
* @NoCSRFRequired
Expand Down
17 changes: 16 additions & 1 deletion lib/Controller/SettingTemplateApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,22 @@ public function show(int $id): DataResponse {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
}

/**
* @NoAdminRequired
*
* @NoCSRFRequired
*
* @param string $templateKey
*
* @return DataResponse
*/
public function showByTemplateKey(string $templateKey): DataResponse {
try {
return new DataResponse($this->mapper->getByTemplateKey($templateKey));
} catch (Exception $e) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
}
/**
* @NoAdminRequired
*
Expand Down
1 change: 0 additions & 1 deletion lib/Db/SettingKeyMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public function findByTemplateId(int $id): array {

return $this->findEntities($qb);
}

/**
* @return \OCP\AppFramework\Db\Entity[]
*
Expand Down
5 changes: 3 additions & 2 deletions lib/Db/SettingTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@

class SettingTemplate extends Entity implements JsonSerializable {
protected $templatename;

protected $templatekey;
public function __construct() {
// add types in constructor
}

public function jsonSerialize() {
return [
'id' => $this->id,
'templatename' => $this->templatename
'templatename' => $this->templatename,
'templatekey' => $this->templatekey
];
}
}
20 changes: 18 additions & 2 deletions lib/Db/SettingTemplateMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,23 @@ public function find(int $id): \OCP\AppFramework\Db\Entity {

return $this->findEntity($qb);
}
/**
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
*
* @return \OCP\AppFramework\Db\Entity
*/
public function getByTemplateKey(string $templatekey): \OCP\AppFramework\Db\Entity {
$qb = $this->db->getQueryBuilder();

$qb->select('*')
->from('sndnt_stngtmplt')
->where(
$qb->expr()->eq('templatekey', $qb->createNamedParameter($templatekey, IQueryBuilder::PARAM_STR))
);

return $this->findEntity($qb);
}
/**
* @return \OCP\AppFramework\Db\Entity[]
*
Expand All @@ -47,13 +63,13 @@ public function findAll($limit = null, $offset = null): array {
return $this->findEntities($qb);
}

public function settingKeyCount($name) {
public function settingTemplateCount($templatekey) {
$qb = $this->db->getQueryBuilder();

$qb->selectAlias($qb->createFunction('COUNT(*)'), 'count')
->from('sndnt_stngtmplt')
->where(
$qb->expr()->eq('templatename', $qb->createNamedParameter($name, IQueryBuilder::PARAM_STR))
$qb->expr()->eq('templatekey', $qb->createNamedParameter($templatekey, IQueryBuilder::PARAM_STR))
);

$cursor = $qb->execute();
Expand Down
85 changes: 85 additions & 0 deletions lib/Migration/Version000020Date20241019100000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

declare(strict_types=1);

/**
* @copyright Copyright (c) 2022 Your name <[email protected]>
*
* @author Your name <[email protected]>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCA\Sendent\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version000020Date20241019100000 extends SimpleMigrationStep {

/** @var IDBConnection */
private $db;

public function __construct(IDBConnection $db) {
$this->db = $db;
}

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
}

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

if ($schema->hasTable('sndnt_stngtmplt')) {
// Adds a column to store templatekey
$table = $schema->getTable('sndnt_stngtmplt');
$table->addColumn('templatekey', \OCP\DB\Types::STRING, [
'notnull' => false,
'default' => '-1'
]);

//$table->addUniqueIndex(['templatekey'], 'sendent_templatekey_index');
}


return $schema;
}

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*/
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {

}
}
Loading

0 comments on commit 3dc1ec0

Please sign in to comment.