forked from Aspen-Discovery/aspen-discovery
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an SMTP Settings option under Aspen Administration -> Email. Included in the patch should be all the database + permissions changes.
- Loading branch information
Showing
6 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
require_once ROOT_DIR . '/Action.php'; | ||
require_once ROOT_DIR . '/services/Admin/ObjectEditor.php'; | ||
require_once ROOT_DIR . '/sys/Email/SMTPSetting.php'; | ||
|
||
class Admin_SMTPSettings extends ObjectEditor { | ||
function getObjectType(): string { | ||
return 'SMTPSetting'; | ||
} | ||
|
||
function getToolName(): string { | ||
return 'SMTPSettings'; | ||
} | ||
|
||
function getModule(): string { | ||
return 'Admin'; | ||
} | ||
|
||
function getPageTitle(): string { | ||
return 'SMTP Settings'; | ||
} | ||
|
||
function getAllObjects($page, $recordsPerPage): array { | ||
$object = new SMTPSetting(); | ||
$object->limit(($page - 1) * $recordsPerPage, $recordsPerPage); | ||
$this->applyFilters($object); | ||
$object->find(); | ||
$objectList = []; | ||
while ($object->fetch()) { | ||
$objectList[$object->id] = clone $object; | ||
} | ||
return $objectList; | ||
} | ||
|
||
function getDefaultSort(): string { | ||
return 'id asc'; | ||
} | ||
|
||
function canSort(): bool { | ||
return false; | ||
} | ||
|
||
function getObjectStructure($context = ''): array { | ||
return SMTPSetting::getObjectStructure($context); | ||
} | ||
|
||
function getPrimaryKeyColumn(): string { | ||
return 'id'; | ||
} | ||
|
||
function getIdKeyColumn(): string { | ||
return 'id'; | ||
} | ||
|
||
function getAdditionalObjectActions($existingObject): array { | ||
return []; | ||
} | ||
|
||
function getInstructions(): string { | ||
return ''; | ||
} | ||
|
||
function getBreadcrumbs(): array { | ||
$breadcrumbs = []; | ||
$breadcrumbs[] = new Breadcrumb('/Admin/Home', 'Administration Home'); | ||
$breadcrumbs[] = new Breadcrumb('/Admin/Home#system_admin', 'System Administration'); | ||
$breadcrumbs[] = new Breadcrumb('/Admin/SMTPSettings', 'SMTP Settings'); | ||
return $breadcrumbs; | ||
} | ||
|
||
function getActiveAdminSection(): string { | ||
return 'email'; | ||
} | ||
|
||
function canView(): bool { | ||
return UserAccount::userHasPermission('Administer SMTP'); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
|
||
class SMTPSetting extends DataObject { | ||
public $__table = 'smtp_settings'; | ||
public $id; | ||
public $name; | ||
public $host; | ||
public $port; | ||
public $ssl_mode; | ||
public $from_address; | ||
public $user_name; | ||
public $password; | ||
|
||
public static function getObjectStructure($context = ''): array { | ||
return [ | ||
'id' => [ | ||
'property' => 'id', | ||
'type' => 'label', | ||
'label' => 'Id', | ||
'description' => 'The unique id', | ||
], | ||
'name' => [ | ||
'property' => 'name', | ||
'type' => 'text', | ||
'label' => 'Server name', | ||
'description' => 'The name of the server', | ||
'default' => 'heyo', | ||
'required' => true, | ||
], | ||
'host' => [ | ||
'property' => 'host', | ||
'type' => 'text', | ||
'label' => 'Host', | ||
'description' => 'The SMTP host', | ||
'default' => 'localhost', | ||
'required' => true, | ||
], | ||
'port' => [ | ||
'property' => 'port', | ||
'type' => 'integer', | ||
'label' => 'Port', | ||
'description' => 'The utilized port', | ||
'default' => '25', | ||
'required' => true, | ||
], | ||
'ssl_mode' => [ | ||
'property' => 'ssl_mode', | ||
'type' => 'enum', | ||
'values' => [ | ||
'disabled' => 'Disabled', | ||
'ssl' => 'SSL', | ||
'tls' => 'StartTLS', | ||
], | ||
'label' => 'SSL mode', | ||
'description' => 'SSL mode', | ||
], | ||
'from_address' => [ | ||
'property' => 'from_address', | ||
'type' => 'text', | ||
'label' => 'From', | ||
'description' => 'The \'From:\' e-mail address', | ||
'default' => '', | ||
'required' => true, | ||
], | ||
'user_name' => [ | ||
'property' => 'user_name', | ||
'type' => 'text', | ||
'label' => 'Username', | ||
'description' => 'The username', | ||
'default' => '', | ||
'required' => true, | ||
], | ||
'password' => [ | ||
'property' => 'password', | ||
'type' => 'storedPassword', | ||
'label' => 'Password', | ||
'description' => 'The password', | ||
'default' => '', | ||
], | ||
]; | ||
} | ||
|
||
function getActiveAdminSection(): string { | ||
return 'system_admin'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters