本文整理汇总了PHP中QubitAcl::forwardToSecureAction方法的典型用法代码示例。如果您正苦于以下问题:PHP QubitAcl::forwardToSecureAction方法的具体用法?PHP QubitAcl::forwardToSecureAction怎么用?PHP QubitAcl::forwardToSecureAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QubitAcl
的用法示例。
在下文中一共展示了QubitAcl::forwardToSecureAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($request)
{
$this->resource = $this->getRoute()->resource;
// Check that this isn't the root
if (!isset($this->resource->parent)) {
$this->forward404();
}
// Check user authorization
if (!QubitAcl::check($this->resource, 'read')) {
QubitAcl::forwardToSecureAction();
}
if ('print' == $request->getGetParameter('media', 'screen')) {
$this->getResponse()->addStylesheet('print-preview', 'last');
}
// Only show link to view/download master copy of digital object if the
// user has readMaster permissions OR it's a text object (to allow reading)
$this->digitalObjectLink = null;
if (0 < count($this->resource->digitalObjects) && (QubitAcl::check($this->resource, 'readMaster') || in_array($this->resource->digitalObjects[0]->mediaTypeId, array(QubitTerm::TEXT_ID, QubitTerm::AUDIO_ID)))) {
if (QubitTerm::EXTERNAL_URI_ID == $this->resource->digitalObjects[0]->usageId) {
$this->digitalObjectLink = $this->resource->digitalObjects[0]->path;
} else {
$this->digitalObjectLink = $request->getUriPrefix() . $request->getRelativeUrlRoot() . $this->resource->digitalObjects[0]->getFullPath();
}
}
QubitImageFlow::addAssets($this->response);
QubitTreeView::addAssets($this->response);
}
示例2: execute
public function execute($request)
{
$this->resource = $this->getRoute()->resource;
// Check user authorization
if (!QubitAcl::check($this->resource, 'read')) {
QubitAcl::forwardToSecureAction();
}
if (1 > strlen($title = $this->resource->__toString())) {
$title = $this->context->i18n->__('Untitled');
}
$this->response->setTitle("{$title} - {$this->response->getTitle()}");
if (QubitAcl::check($this->resource, 'update')) {
$validatorSchema = new sfValidatorSchema();
$values = array();
$validatorSchema->date = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Acquisition date - This is a mandatory element.')));
$values['date'] = $this->resource->date;
$validatorSchema->sourceOfAcquisition = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Source of acquisition - This is a mandatory element.')));
$values['sourceOfAcquisition'] = $this->resource->getSourceOfAcquisition(array('culltureFallback' => true));
$validatorSchema->locationInformation = new sfValidatorString(array('required' => true), array('required' => $this->context->i18n->__('Location information - This is a mandatory element.')));
$values['locationInformation'] = $this->resource->getLocationInformation(array('culltureFallback' => true));
try {
$validatorSchema->clean($values);
} catch (sfValidatorErrorSchema $e) {
$this->errorSchema = $e;
}
}
}
示例3: earlyExecute
protected function earlyExecute()
{
$this->form->getValidatorSchema()->setOption('allow_extra_fields', true);
$this->form->getValidatorSchema()->setPostValidator(new sfValidatorSchemaCompare('password', '==', 'confirmPassword', array(), array('invalid' => $this->context->i18n->__('Your password confirmation did not match you password.'))));
$this->resource = new QubitUser();
if (isset($this->getRoute()->resource)) {
$this->resource = $this->getRoute()->resource;
}
// Except for administrators, only allow users to reset their own password
if (!$this->context->user->hasCredential('administrator')) {
if ($this->resource->id != $this->context->user->getAttribute('user_id')) {
QubitAcl::forwardToSecureAction();
}
}
}