예제 #1
0
 public function __construct(LangInterface $lang)
 {
     $this->lang = $lang;
     if (!has_cap('manage_languages')) {
         throw new PermissionException('Access denied');
     }
 }
예제 #2
0
 public function __construct(AdminMenuInterface $admenu)
 {
     $this->admenu = $admenu;
     if (!has_cap('manage_admin_menus')) {
         throw new PermissionException('Access denied');
     }
 }
예제 #3
0
 public function massdel(Request $request)
 {
     if (!has_cap('delete_roomtypes')) {
         throw new PermissionException('Access denied');
     }
     DB::beginTransaction();
     try {
         $this->roomtype->massdel($request);
         DB::commit();
         return redirect()->back()->with('Mess', 'Đã xóa!');
     } catch (ExcuteNullException $e) {
         DB::rollBack();
         return redirect()->back()->with('errorMess', $e->getErrors());
     }
 }
예제 #4
0
 public function generateMenu($lists, $parent = 0)
 {
     $output = '';
     foreach ($lists as $key => $item) {
         if (has_cap($item->permission)) {
             if ($item->parent == $parent) {
                 $route = $item->route ? route($item->route) : '';
                 $active = \Request::route()->getName() == $item->route ? ' active ' : '';
                 if ($item->has_child()) {
                     $output .= '<li class="has-child ' . $active . '">';
                     $output .= '<a href="' . $route . '">' . '<i class="fa ' . $item->icon . '"> </i> ' . '<span> ' . $item->name . '</span> ' . '<i class="fa fa-angle-right pull-right"> </i></a>';
                     unset($lists[$key]);
                     $output2 = $this->generateMenu($lists, $item->id);
                     $output .= '<ul class="menu-child">' . $output2 . '</ul>';
                 } else {
                     $output .= '<li class="' . $active . '">';
                     $output .= '<a href="' . $route . '">' . '<i class="fa ' . $item->icon . '"> </i> ' . '<span> ' . $item->name . '</span> ' . '</a>';
                     unset($lists[$key]);
                 }
                 $output .= '</li>';
             }
         }
     }
     return $output;
 }
예제 #5
0
파일: Helper.php 프로젝트: huudo/bds1
function authorize_other($permission, $other_permission, $author_id)
{
    if (!has_cap($other_permission, $author_id)) {
        if (!has_cap($permission, $author_id)) {
            throw new PermissionException('Access denied');
        }
    }
}