use new method SeedDMS_Core_[Document|Folder]::isType()

This commit is contained in:
Uwe Steinmann 2019-08-08 09:05:40 +02:00
parent 078847ab9b
commit 7576bee235

View File

@ -62,7 +62,7 @@ class SeedDMS_AccessOperation {
* even if is disallowed in the settings. * even if is disallowed in the settings.
*/ */
function mayEditVersion($vno=0) { /* {{{ */ function mayEditVersion($vno=0) { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
if($vno) if($vno)
$version = $this->obj->getContentByVersion($vno); $version = $this->obj->getContentByVersion($vno);
else else
@ -86,7 +86,7 @@ class SeedDMS_AccessOperation {
* even if is disallowed in the settings. * even if is disallowed in the settings.
*/ */
function mayRemoveVersion() { /* {{{ */ function mayRemoveVersion() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$versions = $this->obj->getContent(); $versions = $this->obj->getContent();
if ((($this->settings->_enableVersionDeletion && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin() ) && (count($versions) > 1)) { if ((($this->settings->_enableVersionDeletion && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin() ) && (count($versions) > 1)) {
return true; return true;
@ -106,7 +106,7 @@ class SeedDMS_AccessOperation {
* even if is disallowed in the settings. * even if is disallowed in the settings.
*/ */
function mayOverwriteStatus() { /* {{{ */ function mayOverwriteStatus() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_RELEASED || $status["status"]==S_OBSOLETE )) { if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && ($status["status"]==S_RELEASED || $status["status"]==S_OBSOLETE )) {
@ -127,7 +127,7 @@ class SeedDMS_AccessOperation {
* settings. * settings.
*/ */
function maySetReviewersApprovers() { /* {{{ */ function maySetReviewersApprovers() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
$reviewstatus = $latestContent->getReviewStatus(); $reviewstatus = $latestContent->getReviewStatus();
@ -159,7 +159,7 @@ class SeedDMS_AccessOperation {
* settings. * settings.
*/ */
function maySetWorkflow() { /* {{{ */ function maySetWorkflow() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$workflow = $latestContent->getWorkflow(); $workflow = $latestContent->getWorkflow();
if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflow->getInitState()->getID() == $latestContent->getWorkflowState()->getID()))) { if ((($this->settings->_enableVersionModification && ($this->obj->getAccessMode($this->user) == M_ALL)) || $this->user->isAdmin()) && (!$workflow || ($workflow->getInitState()->getID() == $latestContent->getWorkflowState()->getID()))) {
@ -176,7 +176,7 @@ class SeedDMS_AccessOperation {
* expiration date is only allowed if the document has not been obsoleted. * expiration date is only allowed if the document has not been obsoleted.
*/ */
function maySetExpires() { /* {{{ */ function maySetExpires() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ((($this->obj->getAccessMode($this->user) == M_ALL) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) { if ((($this->obj->getAccessMode($this->user) == M_ALL) || $this->user->isAdmin()) && ($status["status"]!=S_OBSOLETE)) {
@ -196,7 +196,7 @@ class SeedDMS_AccessOperation {
* disallowed in the settings. * disallowed in the settings.
*/ */
function mayEditComment() { /* {{{ */ function mayEditComment() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
if($this->obj->isLocked()) { if($this->obj->isLocked()) {
$lockingUser = $this->obj->getLockingUser(); $lockingUser = $this->obj->getLockingUser();
if (($lockingUser->getID() != $this->user->getID()) && ($this->obj->getAccessMode($this->user) != M_ALL)) { if (($lockingUser->getID() != $this->user->getID()) && ($this->obj->getAccessMode($this->user) != M_ALL)) {
@ -222,7 +222,7 @@ class SeedDMS_AccessOperation {
* disallowed in the settings. * disallowed in the settings.
*/ */
function mayEditAttributes() { /* {{{ */ function mayEditAttributes() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
$workflow = $latestContent->getWorkflow(); $workflow = $latestContent->getWorkflow();
@ -241,7 +241,7 @@ class SeedDMS_AccessOperation {
* account here. * account here.
*/ */
function mayReview() { /* {{{ */ function mayReview() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ($status["status"]==S_DRAFT_REV) { if ($status["status"]==S_DRAFT_REV) {
@ -276,7 +276,7 @@ class SeedDMS_AccessOperation {
* account here. * account here.
*/ */
function mayApprove() { /* {{{ */ function mayApprove() { /* {{{ */
if(get_class($this->obj) == $this->dms->getClassname('document')) { if($this->obj->isType('document')) {
$latestContent = $this->obj->getLatestContent(); $latestContent = $this->obj->getLatestContent();
$status = $latestContent->getStatus(); $status = $latestContent->getStatus();
if ($status["status"]==S_DRAFT_APP) { if ($status["status"]==S_DRAFT_APP) {