Author: sevein
Date: Sun Nov 29 07:11:43 2009
New Revision: 3994

Log:
Limit validation checks to users with update privileges in show pages (ISDIAH, 
ISAAR, ISAD).

Modified:
   trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php
   trunk/apps/qubit/modules/informationobject/actions/showIsadAction.class.php
   trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php

Modified: trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php    Sun Nov 
29 00:06:45 2009        (r3993)
+++ trunk/apps/qubit/modules/actor/actions/showIsaarAction.class.php    Sun Nov 
29 07:11:43 2009        (r3994)
@@ -33,23 +33,27 @@
     // run the core actor show action commands
     parent::execute($request);
 
-    $validatorSchema = new sfValidatorSchema;
-    $validatorSchema->authorizedFormOfName = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Authorized form of name%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
-    $validatorSchema->datesOfExistence = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Dates of existence%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
-    $validatorSchema->descriptionIdentifier = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Authority record identifier%2% - This is a 
mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
-    $validatorSchema->entityType = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('%1%Type of entity%2% - 
This is a mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
-
-    try
-    {
-      $validatorSchema->clean(array(
-        'authorizedFormOfName' => $this->actor->authorizedFormOfName,
-        'datesOfExistence' => $this->actor->datesOfExistence,
-        'descriptionIdentifier' => $this->actor->descriptionIdentifier,
-        'entityType' => $this->actor->entityType));
-    }
-    catch (sfValidatorErrorSchema $e)
+    // add ISAAR specific commands
+    if (QubitAcl::check($this->actor, QubitAclAction::UPDATE_ID))
     {
-      $this->errorSchema = $e;
+      $validatorSchema = new sfValidatorSchema;
+      $validatorSchema->authorizedFormOfName = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Authorized form of name%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
+      $validatorSchema->datesOfExistence = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Dates of existence%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
+      $validatorSchema->descriptionIdentifier = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Authority record identifier%2% - This is a 
mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
+      $validatorSchema->entityType = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('%1%Type of entity%2% - 
This is a mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-2#4.7";>', '%2%' => '</a>'))));
+
+      try
+      {
+        $validatorSchema->clean(array(
+          'authorizedFormOfName' => $this->actor->authorizedFormOfName,
+          'datesOfExistence' => $this->actor->datesOfExistence,
+          'descriptionIdentifier' => $this->actor->descriptionIdentifier,
+          'entityType' => $this->actor->entityType));
+      }
+      catch (sfValidatorErrorSchema $e)
+      {
+        $this->errorSchema = $e;
+      }
     }
   }
 }

Modified: 
trunk/apps/qubit/modules/informationobject/actions/showIsadAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/showIsadAction.class.php 
Sun Nov 29 00:06:45 2009        (r3993)
+++ trunk/apps/qubit/modules/informationobject/actions/showIsadAction.class.php 
Sun Nov 29 07:11:43 2009        (r3994)
@@ -30,29 +30,34 @@
 {
   public function execute($request)
   {
+    // run the core information object show action commands
     parent::execute($request);
 
-    $validatorSchema = new sfValidatorSchema;
-    $validatorSchema->creators = new QubitValidatorCountable(array('required' 
=> true), array('required' => $this->context->i18n->__('This archival 
description should %1%content at least on creator%2%.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
-    $validatorSchema->dates = new QubitValidatorCountable(array('required' => 
true), array('required' => $this->context->i18n->__('This archival description 
should %1%content at least one date%2%.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
-    $validatorSchema->extentAndMedium = new sfValidatorString(array('required' 
=> true), array('required' => $this->context->i18n->__('%1%Extent and medium%2% 
- This is a mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
-    $validatorSchema->identifier = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is 
a mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
-    $validatorSchema->levelOfDescription = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Level of description%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
-    $validatorSchema->title = new sfValidatorString(array('required' => true), 
array('required' => $this->context->i18n->__('This archival description is 
untitled. A title is %1%considered essential%2% for international exchange of 
descriptive information.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
-
-    try
-    {
-      $validatorSchema->clean(array(
-        'creators' => $this->informationObject->getCreators(),
-        'dates' => $this->informationObject->getDates(),
-        'extentAndMedium' => $this->informationObject->extentAndMedium,
-        'identifier' => $this->informationObject->identifier,
-        'levelOfDescription' => $this->informationObject->levelOfDescription,
-        'title' => $this->informationObject->title));
-    }
-    catch (sfValidatorErrorSchema $e)
+    // add ISAD specific commands
+    if (QubitAcl::check($this->informationObject, QubitAclAction::UPDATE_ID))
     {
-      $this->errorSchema = $e;
+      $validatorSchema = new sfValidatorSchema;
+      $validatorSchema->creators = new 
QubitValidatorCountable(array('required' => true), array('required' => 
$this->context->i18n->__('This archival description should %1%content at least 
on creator%2%.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
+      $validatorSchema->dates = new QubitValidatorCountable(array('required' 
=> true), array('required' => $this->context->i18n->__('This archival 
description should %1%content at least one date%2%.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
+      $validatorSchema->extentAndMedium = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Extent and medium%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
+      $validatorSchema->identifier = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is 
a mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
+      $validatorSchema->levelOfDescription = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Level of description%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
+      $validatorSchema->title = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('This archival description 
is untitled. A title is %1%considered essential%2% for international exchange 
of descriptive information.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-1#I.12";>', '%2%' => 
'</a>'))));
+
+      try
+      {
+        $validatorSchema->clean(array(
+          'creators' => $this->informationObject->getCreators(),
+          'dates' => $this->informationObject->getDates(),
+          'extentAndMedium' => $this->informationObject->extentAndMedium,
+          'identifier' => $this->informationObject->identifier,
+          'levelOfDescription' => $this->informationObject->levelOfDescription,
+          'title' => $this->informationObject->title));
+      }
+      catch (sfValidatorErrorSchema $e)
+      {
+        $this->errorSchema = $e;
+      }
     }
 
     // Split notes into "Notes" (general notes), Title notes and Publication 
notes

Modified: trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php      
Sun Nov 29 00:06:45 2009        (r3993)
+++ trunk/apps/qubit/modules/repository/actions/showIsdiahAction.class.php      
Sun Nov 29 07:11:43 2009        (r3994)
@@ -34,21 +34,24 @@
     parent::execute($request);
 
     // add ISDIAH specific commands
-    $validatorSchema = new sfValidatorSchema;
-    $validatorSchema->authorizedFormOfName = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Authorized form of name%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-3#4.7";>', '%2%' => '</a>'))));
-    $validatorSchema->identifier = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is 
a mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-3#4.7";>', '%2%' => '</a>'))));
-    $validatorSchema->locationAndAddress = new 
QubitValidatorIsdiahLocationAndAddress;
-
-    try
-    {
-      $validatorSchema->clean(array(
-        'authorizedFormOfName' => $this->repository->authorizedFormOfName,
-        'identifier' => $this->repository->identifier,
-        'locationAndAddress' => $this->repository));
-    }
-    catch (sfValidatorErrorSchema $e)
+    if (QubitAcl::check($this->repository, QubitAclAction::UPDATE_ID))
     {
-      $this->errorSchema = $e;
+      $validatorSchema = new sfValidatorSchema;
+      $validatorSchema->authorizedFormOfName = new 
sfValidatorString(array('required' => true), array('required' => 
$this->context->i18n->__('%1%Authorized form of name%2% - This is a mandatory 
field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-3#4.7";>', '%2%' => '</a>'))));
+      $validatorSchema->identifier = new sfValidatorString(array('required' => 
true), array('required' => $this->context->i18n->__('%1%Identifier%2% - This is 
a mandatory field.', array('%1%' => '<a 
href="http://ica-atom.org/docs/index.php?title=RS-3#4.7";>', '%2%' => '</a>'))));
+      $validatorSchema->locationAndAddress = new 
QubitValidatorIsdiahLocationAndAddress;
+
+      try
+      {
+        $validatorSchema->clean(array(
+          'authorizedFormOfName' => $this->repository->authorizedFormOfName,
+          'identifier' => $this->repository->identifier,
+          'locationAndAddress' => $this->repository));
+      }
+      catch (sfValidatorErrorSchema $e)
+      {
+        $this->errorSchema = $e;
+      }
     }
 
     $this->parallelFormsOfName = $this->repository->getParallelFormsOfName();

--

You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.


Reply via email to