mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-03-25 17:22:22 -04:00
- Revert accidental Users.RoleId FK change from CASCADE back to SET NULL
- Remove System != 'None' gate in beforeFilter; any authenticated user
can manage their own notifications, per-row ownership checks suffice
- Add allowMethod('post', 'put') guard to edit() for consistent REST behavior
- Change PushState validation from allowEmpty to required=false
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
902 B
PHP
40 lines
902 B
PHP
<?php
|
|
App::uses('AppModel', 'Model');
|
|
|
|
class Notification extends AppModel {
|
|
|
|
public $useTable = 'Notifications';
|
|
public $primaryKey = 'Id';
|
|
public $displayField = 'Token';
|
|
|
|
public $belongsTo = array(
|
|
'User' => array(
|
|
'className' => 'User',
|
|
'foreignKey' => 'UserId',
|
|
),
|
|
);
|
|
|
|
public $validate = array(
|
|
'Token' => array(
|
|
'notBlank' => array(
|
|
'rule' => array('notBlank'),
|
|
'message' => 'Token is required',
|
|
),
|
|
),
|
|
'Platform' => array(
|
|
'inList' => array(
|
|
'rule' => array('inList', array('android', 'ios', 'web')),
|
|
'message' => 'Platform must be android, ios, or web',
|
|
),
|
|
),
|
|
'PushState' => array(
|
|
'inList' => array(
|
|
'rule' => array('inList', array('enabled', 'disabled')),
|
|
'message' => 'PushState must be enabled or disabled',
|
|
'required' => false,
|
|
),
|
|
),
|
|
);
|
|
|
|
}
|