mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-01 11:04:47 +02:00
* Add ticket/search test (ruby) * Resolve github maxi comments. * Resolve github maxi comments second part. * wip * Rename some test. * Add query filter test. * Add test combining multiple parameters. * wip * comment query test in search.rb * comment query test in search.rb second part.
24 lines
574 B
PHP
24 lines
574 B
PHP
<?php
|
|
|
|
namespace CustomValidations;
|
|
|
|
use Respect\Validation\Rules\AbstractRule;
|
|
|
|
class ValidAuthorsId extends AbstractRule {
|
|
|
|
public function validate($authors) {
|
|
if(is_array(json_decode($authors))){
|
|
foreach (json_decode($authors) as $authorObject) {
|
|
if(!is_object($authorObject)) return false;
|
|
if($authorObject->isStaff) {
|
|
$author = \Staff::getDataStore($authorObject->id);
|
|
} else {
|
|
$author = \User::getDataStore($authorObject->id);
|
|
}
|
|
if($author->isNull()) return false;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
} |