Skip to content
Snippets Groups Projects
Commit 0dfd61e6 authored by Dorian Merz's avatar Dorian Merz
Browse files

Merge branch 'master-v5' into instance/fid

parents 79d273dd 32fbf69e
Branches
Tags
No related merge requests found
......@@ -34,6 +34,7 @@ namespace finc\RecordDriver;
use VuFindSearch\ParamBag;
use VuFindSearch\Query\Query as Query;
use Zend\Config\Config;
/**
* finc specific model for Solr records based on the stock
......@@ -155,6 +156,26 @@ trait SolrDefaultFincTrait
return null;
}
public function hasRecordPermission(String $permission) : bool
{
// do we have a RecordPermissions section in config.ini?
if (isset($this->mainConfig->RecordPermissions)) {
$settings = $this->mainConfig->RecordPermissions->{$permission} ?? null;
if (is_null($settings)) return false;
if ($settings instanceof Config) $settings = $settings->toArray();
foreach ((array) $settings as $value) {
list($methodName, $methodReturn) = explode(':', $value);
if (in_array($methodReturn, (array) $this->tryMethod($methodName))) {
// as the current permission matches the current record,
// return it
return true;
}
}
}
// either no settings for the permission were present or none matched, so return false
return false;
}
/**
* Controller to decide when local format field of a library should be
* retrieved from marc. Pass through method for PrimoCentral
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment