Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Initial implementation of Notifications (CFM-108) and Message Templat…
…es (CFM-133)
Benn Oshrin committed Apr 29, 2024
1 parent b8a627a commit dff56a5
Showing 53 changed files with 2,978 additions and 133 deletions.
7 changes: 6 additions & 1 deletion app/config/app.php
@@ -204,7 +204,8 @@
*/
'Error' => [
'errorLevel' => E_ALL,
'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
// This is deprecated and could probably be completely removed
// 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer',
'skipLog' => [],
'log' => true,
'trace' => true,
@@ -228,6 +229,8 @@
* You can add custom transports (or override existing transports) by adding the
* appropriate file to src/Mailer/Transport. Transports should be named
* 'YourTransport.php', where 'Your' is the name of the transport.
*
* Note Registry uses dynamic configuration for EmailTransport.
*/
'EmailTransport' => [
'default' => [
@@ -254,6 +257,8 @@
* duplication across your application and makes maintenance and development
* easier. Each profile accepts a number of keys. See `Cake\Mailer\Email`
* for more information.
*
* Note Registry uses dynamic configuration for Email.
*/
'Email' => [
'default' => [
88 changes: 74 additions & 14 deletions app/config/schema/schema.json
@@ -93,6 +93,19 @@
}
},

"servers": {
"columns": {
"id": {},
"co_id": {},
"description": {},
"plugin": {},
"status": {}
},
"indexes": {
"servers_i1": { "columns": [ "co_id" ] }
}
},

"co_settings": {
"comment": "Table definition not yet complete (CFM-80)",

@@ -106,6 +119,8 @@
"default_pronoun_type_id": { "type": "integer", "foreignkey": { "table": "types", "column": "id" } },
"default_telephone_number_type_id": { "type": "integer", "foreignkey": { "table": "types", "column": "id" } },
"default_url_type_id": { "type": "integer", "foreignkey": { "table": "types", "column": "id" } },
"email_delivery_address_type_id": { "type": "integer", "foreignkey": { "table": "types", "column": "id" } },
"email_smtp_server_id": { "type": "integer", "foreignkey": { "table": "servers", "column": "id" } },
"permitted_fields_name": { "type": "string", "size": 160 },
"permitted_fields_telephone_number": { "type": "string", "size": 160 },
"required_fields_address": { "type": "string", "size": 160 },
@@ -131,7 +146,9 @@
"co_settings_i5": { "columns": [ "default_address_type_id" ] },
"co_settings_i6": { "columns": [ "default_pronoun_type_id" ] },
"co_settings_i7": { "columns": [ "default_telephone_number_type_id" ] },
"co_settings_i8": { "columns": [ "default_url_type_id" ] }
"co_settings_i8": { "columns": [ "default_url_type_id" ] },
"co_settings_i9": { "columns": [ "email_delivery_address_type_id" ] },
"co_settings_i10": { "columns": [ "email_smtp_server_id" ] }
}
},

@@ -521,6 +538,62 @@
}
},

"message_templates": {
"columns": {
"id": {},
"co_id": {},
"description": {},
"status": {},
"context": {},
"format": { "type": "string", "size": 4 },
"subject": { "type": "string", "size": 256 },
"body_text": { "type": "text" },
"body_html": { "type": "text" },
"cc": { "type": "string", "size": 256 },
"bcc": { "type": "string", "size": 256 },
"reply_to": { "type": "string", "size": 256 }
},
"indexes": {
"message_templates_i1": { "columns": [ "co_id" ] }
}
},

"notifications": {
"columns": {
"id": {},
"subject_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"subject_group_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"actor_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"recipient_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"recipient_group_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"resolver_person_id": { "type": "integer", "foreignkey": { "table": "people", "column": "id" } },
"action": {
"comment": "revert this to use the library definition after feature-cfm31 merge",
"type": "string", "size": 4
},
"comment": {},
"message_template_id": { "type": "integer", "foreignkey": { "table": "message_templates", "column": "id" } },
"source": { "type": "text" },
"email_subject": { "type": "string", "size": 256 },
"email_body_text": { "type": "text" },
"email_body_html": { "type": "text" },
"resolution_subject": { "type": "string", "size": 256 },
"resolution_body": { "type": "text" },
"status": {},
"notification_time": { "type": "datetime" },
"resolution_time": { "type": "datetime" }
},
"indexes": {
"notifications_i1": { "columns": [ "subject_person_id" ] },
"notifications_i2": { "columns": [ "subject_group_id" ] },
"notifications_i3": { "columns": [ "recipient_person_id" ] },
"notifications_i4": { "columns": [ "recipient_group_id" ] },
"notifications_i5": { "columns": [ "source" ] },
"notifications_i6": { "needed": false, "columns": [ "actor_person_id" ] },
"notifications_i7": { "needed": false, "columns": [ "resolver_person_id" ] }
}
},

"jobs": {
"columns": {
"id": {},
@@ -570,19 +643,6 @@
}
},

"servers": {
"columns": {
"id": {},
"co_id": {},
"description": {},
"plugin": {},
"status": {}
},
"indexes": {
"servers_i1": { "columns": [ "co_id" ] }
}
},

"identifier_assignments": {
"columns": {
"id": {},
28 changes: 28 additions & 0 deletions app/plugins/CoreServer/resources/locales/en_US/core_server.po
@@ -22,6 +22,9 @@
# @since COmanage Registry v5.0.0
# @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)

msgid "controller.SmtpServers"
msgstr "{0,plural,=1{SMTP Server} other{SMTP Servers}}"

msgid "controller.SqlServers"
msgstr "{0,plural,=1{SQL Server} other{SQL Servers}}"

@@ -43,6 +46,31 @@ msgstr "Oracle"
msgid "enumeration.RdbmsTypeEnum.PG"
msgstr "Postgres"

msgid "field.SmtpServers.default_from"
msgstr "Default From Address"

msgid "field.SmtpServers.default_reply_to"
msgstr "Default Reply-To Address"

msgid "field.SmtpServers.hostname"
msgstr "Hostname"

msgid "field.SmtpServers.override_to"
msgstr "Delivery Override"

msgid "field.SmtpServers.override_to.desc"
msgstr "If set, all outgoing email will only be sent to this address"

# XXX Temporary?
msgid "field.SmtpServers.password"
msgstr "Password"

msgid "field.SmtpServers.port"
msgstr "Port"

msgid "field.SmtpServers.use_tls"
msgstr "Use TLS"

msgid "error.SqlServers.oracle.enabled"
msgstr "Oracle support is not enabled"

40 changes: 40 additions & 0 deletions app/plugins/CoreServer/src/Controller/SmtpServersController.php
@@ -0,0 +1,40 @@
<?php
/**
* COmanage Registry SMTP Servers Controller
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry-plugins
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types=1);

namespace CoreServer\Controller;

use App\Controller\StandardPluginController;

class SmtpServersController extends StandardPluginController {
public $paginate = [
'order' => [
'SmtpServers.hostname' => 'asc'
]
];
}
49 changes: 49 additions & 0 deletions app/plugins/CoreServer/src/Model/Entity/SmtpServer.php
@@ -0,0 +1,49 @@
<?php
/**
* COmanage Registry SMTP Server Entity
*
* Portions licensed to the University Corporation for Advanced Internet
* Development, Inc. ("UCAID") under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* UCAID licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @link https://www.internet2.edu/comanage COmanage Project
* @package registry-plugins
* @since COmanage Registry v5.0.0
* @license Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*/

declare(strict_types=1);

namespace CoreServer\Model\Entity;

use Cake\ORM\Entity;

class SmtpServer extends Entity {
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array<string, bool>
*/
protected $_accessible = [
'*' => true,
'id' => false,
'slug' => false,
];
}

0 comments on commit dff56a5

Please sign in to comment.