当前位置: 首页>>代码示例>>PHP>>正文


PHP Access::oaclient方法代码示例

本文整理汇总了PHP中Access::oaclient方法的典型用法代码示例。如果您正苦于以下问题:PHP Access::oaclient方法的具体用法?PHP Access::oaclient怎么用?PHP Access::oaclient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Access的用法示例。


在下文中一共展示了Access::oaclient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_delete

 public function action_delete()
 {
     if (!ACL::check('delete oaclient2')) {
         throw new HTTP_Exception_404('You have no permission to delete oauth2 clients.');
     }
     $id = (int) $this->request->param('id');
     $redirect = empty($this->redirect) ? Route::get('oauth2/client')->uri(array('action' => 'list')) : $this->redirect;
     $oaclient = ORM::factory('oaclient', $id);
     if (!$oaclient->loaded()) {
         Message::error(__('oaclient: doesn\'t exists!'));
         Kohana::$log->add(Log::ERROR, 'Attempt to delete non-existent oaclient');
         $this->request->redirect(Route::get('oauth2/client')->uri(array('action' => 'list')));
     }
     $clone_oaclient = clone $oaclient;
     if (!Access::oaclient('delete', $oaclient)) {
         // If the lead was not loaded, we return access denied.
         throw new HTTP_Exception_404('Attempt to non-existent oaclient.');
     }
     $this->title = __('Delete oaclient');
     $this->subtitle = Text::plain($oaclient->client_id);
     $form = View::factory('form/confirm')->set('action', $oaclient->delete_url)->set('title', $oaclient->client_id);
     // If deletion is not desired, redirect to post
     if (isset($_POST['no']) and $this->valid_post()) {
         $this->request->redirect('oauth2/client');
     }
     // If deletion is confirmed
     if (isset($_POST['yes']) and $this->valid_post()) {
         try {
             $oaclient->delete();
             Message::success(__('oaclient: :title deleted successfully', array(':title' => $clone_oaclient->client_id)));
             $this->request->redirect($redirect);
         } catch (Exception $e) {
             Message::error(__('oaclient: :title unable to delete the record', array(':title' => $clone_oaclient->client_id)));
             $this->request->redirect($redirect);
         }
     }
     $this->response->body($form);
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:38,代码来源:client.php


注:本文中的Access::oaclient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。