/**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->can('delete-permissions')) {
         return '<a href="' . route('admin.access.roles.permissions.destroy', $this->id) . '" class="btn btn-xs btn-danger" data-method="delete"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
     }
     return '';
 }
 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->allow('delete-categories')) {
         return '<a href="' . route('admin.quiz.categories.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.delete') . '"></i></a>';
     }
     return '';
 }
 /**
  * @param  $request
  * @param  callable      $next
  * @param  $permission
  * @return mixed
  */
 public function handle($request, Closure $next, $permission)
 {
     if (!access()->allow($permission)) {
         return redirect()->route('frontend.index')->withFlashDanger(trans('auth.general_error'));
     }
     return $next($request);
 }
Exemple #4
0
 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->can('destroy-team')) {
         return '<a href="' . route('team.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
     }
     return '';
 }
Exemple #5
0
 /**
  * @return string
  */
 public function getResultsButtonAttribute()
 {
     if (access()->allow('see-results') && $this->isCompleted()) {
         return '<a href="' . route('admin.quiz.results.show', $this->id) . '" class="btn btn-xs btn-primary"><i class="fa fa-list" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.backend.quiz.tasks.results') . '"></i></a>';
     }
     return '';
 }
 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     if (access()->can('view-innovate-ecommerce')) {
         return '<a href="' . route('admin.check_out_agreement.destroy', $this->id) . '" data-method="delete" class="btn btn-xs btn-danger"><i class="fa fa-trash" data-toggle="tooltip" data-placement="top" title="' . trans('crud.delete_button') . '"></i></a>';
     }
     return '';
 }
 /**
  * @param User $user
  * @param ManageUserRequest $request
  * @return \Illuminate\Http\RedirectResponse
  * @throws GeneralException
  */
 public function loginAs(User $user, ManageUserRequest $request)
 {
     // Overwrite who we're logging in as, if we're already logged in as someone else.
     if (session()->has('admin_user_id') && session()->has('temp_user_id')) {
         // Let's not try to login as ourselves.
         if (access()->id() == $user->id || session()->get('admin_user_id') == $user->id) {
             throw new GeneralException('Do not try to login as yourself.');
         }
         // Overwrite temp user ID.
         session(['temp_user_id' => $user->id]);
         // Login.
         access()->loginUsingId($user->id);
         // Redirect.
         return redirect()->route("frontend.index");
     }
     app()->make(Auth::class)->flushTempSession();
     // Won't break, but don't let them "Login As" themselves
     if (access()->id() == $user->id) {
         throw new GeneralException("Do not try to login as yourself.");
     }
     // Add new session variables
     session(["admin_user_id" => access()->id()]);
     session(["admin_user_name" => access()->user()->name]);
     session(["temp_user_id" => $user->id]);
     // Login user
     access()->loginUsingId($user->id);
     // Redirect to frontend
     return redirect()->route("frontend.index");
 }
 /**
  * Where to redirect users after login / registration.
  * @return string
  */
 public function redirectPath()
 {
     if (access()->allow('view-backend')) {
         return route('admin.dashboard');
     }
     return route('frontend.user.dashboard');
 }
Exemple #9
0
 /**
  * Init
  */
 public function init()
 {
     parent::init();
     if (access('Dev.*') && cogear()->config->development) {
         hook('done', array($this, 'finish'));
     }
 }
Exemple #10
0
 /**
  * @param $request
  * @param callable $next
  * @param $role
  * @return mixed
  */
 public function handle($request, Closure $next, $role)
 {
     if (!access()->hasRole($role)) {
         return redirect('/')->withFlashDanger("You do not have access to do that.");
     }
     return $next($request);
 }
 /**
  * @param  $request
  * @param callable $next
  * @param  $permission
  *
  * @return mixed
  */
 public function handle($request, Closure $next, $permission)
 {
     if (!access()->can($permission)) {
         return redirect('/')->withFlashDanger('You do not have access to do that.');
     }
     return $next($request);
 }
Exemple #12
0
 /**
  * Хук Роутера
  *
  * @param object $Router
  * @param Callback $callback
  */
 public function hookRouterExec($Router, Callback $callback)
 {
     if (!access($callback->getCallback(0)->gear . '.*') && !access($callback->getCallback(0)->gear . '.' . str_replace('_action', '', $callback->getCallback(1)))) {
         event('403');
         return FALSE;
     }
 }
Exemple #13
0
 function browse()
 {
     $this->user_group_model->can_access(VIEW_LIST_NEWS, null, null);
     $filter = '';
     //view my news
     if (!access(VIEW_ALL_NEWS)) {
         $filter .= ' AND poster = ' . $_SESSION['userdata']['userid'];
     }
     $start = (int) $this->uri->segment(5, 0);
     $limit_per_page = 30;
     $cat_id = (int) $this->uri->segment(3, 0);
     $newsType = $this->uri->segment(4, 'news');
     $this->load->model('ci_newsmodel');
     // Instantiate the model
     $aryNewsList = array();
     $aryNewsList = $this->ci_newsmodel->getNewsList($newsType, $cat_id, $start, $limit_per_page, $filter);
     $the_results['aryNewsList'] = $aryNewsList;
     $the_results['numOfNews'] = $this->ci_newsmodel->table_record_count;
     $the_results['newsType'] = $newsType;
     $this->load->library('pagination');
     $this->load->helper('url');
     $config['total_rows'] = $this->ci_newsmodel->table_record_count;
     $config['per_page'] = $limit_per_page;
     $config['uri_segment'] = 5;
     $config['num_links'] = 3;
     $config['base_url'] = base_url() . 'news/browse/' . $cat_id . '/' . $newsType;
     $this->pagination->initialize($config);
     $the_results['page_links'] = $this->pagination->create_links();
     $the_results['title'] = 'News List';
     $the_results['cat_id'] = $cat_id;
     $this->_display('/ci_news/ci_newsgrid', $the_results);
 }
 /**
  * @param $request
  * @param callable $next
  * @param null $params
  * @return \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Symfony\Component\HttpFoundation\Response
  */
 public function handle($request, Closure $next, $params = null)
 {
     $assets = $this->getAssets($request, $params);
     if (!access()->hasRoles($assets['roles'], $assets['needsAll'])) {
         return $this->getRedirectMethodAndGo($request, $params);
     }
     return $next($request);
 }
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $organizations = access()->user()->organizations()->get();
     if (count($organizations) == 0) {
         return redirect()->to('/');
     }
     $this_url = \Request::url();
     return view('frontend.user_organizations')->with('this_url', $this_url)->with('organizations', $organizations);
 }
 /**
  * @param $per_page
  * @param string $order_by
  * @param string $sort
  * @param int $status
  * @return mixed
  */
 public function getMediasPaginatedTable($per_page, $withUsers = false)
 {
     if ($withUsers) {
         $auth_id = access()->user()->id;
         return Media::where('owner_id', $auth_id)->sort(Input::get('field'), Input::get('sort'))->paginate($per_page);
     } else {
         return Media::sort(Input::get('field'), Input::get('sort'))->paginate($per_page);
     }
 }
Exemple #17
0
 public function getAllMedia()
 {
     if (access()->user()->can('manage_media')) {
         $withOwner = false;
     } else {
         $withOwner = true;
     }
     $media = $this->media->getMediasPaginated(config('access.users.default_per_page'), $withOwner);
     return $media;
 }
 /**
  * @return string
  */
 public function getDeleteButtonAttribute()
 {
     //Can't delete master admin role
     if ($this->id != 1) {
         if (access()->allow('delete-roles')) {
             return '<a href="' . route('admin.access.roles.destroy', $this->id) . '" class="btn btn-xs btn-danger" data-method="delete"><i class="fa fa-times" data-toggle="tooltip" data-placement="top" title="' . trans('buttons.general.crud.delete') . '"></i></a>';
         }
     }
     return '';
 }
 /**
  * @param $per_page
  * @param string $order_by
  * @param string $sort
  * @param int $status
  * @return mixed
  */
 public function getProjectsPaginated($per_page, $order_by = 'id', $sort = 'asc')
 {
     $order_by = null !== Input::get('field') ? Input::get('field') : $order_by;
     $sort = null !== Input::get('sort') ? Input::get('sort') : $sort;
     if (!access()->user()->can('manage_organization')) {
         return Project::where('org_id', access()->user()->organization->id)->orderBy($order_by, $sort)->paginate($per_page);
     } else {
         return Project::orderBy($order_by, $sort)->paginate($per_page);
     }
 }
 /**
  * @param $per_page
  * @param string $order_by
  * @param string $sort
  * @param int $status
  * @return mixed
  */
 public function searchUsers($queue, $status = 1, $order_by = 'id', $sort = 'asc')
 {
     $order_by = null !== Input::get('field') ? Input::get('field') : $order_by;
     $sort = null !== Input::get('sort') ? Input::get('sort') : $sort;
     if (!access()->user()->can('manage_organization')) {
         return User::where('status', $status)->where('org_id', access()->user()->organization->id)->orderBy($order_by, $sort)->search($queue)->get();
     } else {
         return User::where('status', $status)->orderBy($order_by, $sort)->search($queue)->get();
     }
 }
Exemple #21
0
 /**
  * Обработка 404 ошибки
  *
  * Предложение пользователю создать страницу
  */
 public function hook404()
 {
     if ($this->hookRouterRun($this->Router, TRUE)) {
         flash('event.404', FALSE);
     } else {
         if (access('Pages.admin')) {
             append('content', template('Pages/templates/invitation'));
         }
     }
 }
Exemple #22
0
 /**
  * Хук инициализации формы
  *
  * @param type $Form
  */
 public function hookFormLoad($Form)
 {
     if (access('Parser.off')) {
         if ($this->input->post('parser_off')) {
             Cookie::set('parser_off', TRUE);
         }
         if ($Form->body) {
             $Form->add('parser_off', array('type' => 'checkbox', 'label' => t('Отключить парсер'), 'value' => Cookie::get('parser_off') ? TRUE : FALSE, 'order' => $Form->body->options->order . '.1'));
         }
     }
 }
 public function dashboard()
 {
     if (access()->can('manage_hospital')) {
         return redirect('management/dashboard');
     }
     $doctor = auth()->user();
     //Get last 10 reports assigned to this doctor
     $reports = Reports::where('assigned_doctor_id', $doctor->id)->orderBy('id', 'DESC')->paginate(10);
     $data = ['reports' => $reports];
     return view('frontend.doctor.dashboard', $data);
 }
Exemple #24
0
function accessAlbums($attr, $path, $data, $volume)
{
    //	restrict access to his albums
    $base = explode('/', str_replace(getAlbumFolder(SERVERPATH), '', str_replace('\\', '/', $path) . '/'));
    $base = array_shift($base);
    $block = !$base && $attr == 'write';
    if ($block || access($attr, $path, $data, $volume)) {
        return !($attr == 'read' || $attr == 'write');
    }
    return NULL;
}
Exemple #25
0
 /**
  * Filter
  *
  * @value
  */
 public function filter($value)
 {
     if (access('Parser.off') && cogear()->input->post('parser_off')) {
         return $value;
     }
     $jevix = new Parser_Jevix();
     //Конфигурация
     $allowed_tags = array('a', 'img', 'i', 'b', 'u', 'em', 'strong', 'nobr', 'li', 'ol', 'ul', 'sup', 'abbr', 'pre', 'acronym', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'cut', 'user', 'br', 'code', 'p', 'video');
     // 1. Устанавливаем разрешённые теги. (Все не разрешенные теги считаются запрещенными.)
     $jevix->cfgAllowTags($allowed_tags);
     // 2. Устанавливаем коротие теги. (не имеющие закрывающего тега)
     $jevix->cfgSetTagShort(array('br', 'img'));
     // 3. Устанавливаем преформатированные теги. (в них все будет заменятся на HTML сущности)
     $jevix->cfgSetTagPreformatted(array('code'));
     // 4. Устанавливаем теги, которые необходимо вырезать из текста вместе с контентом.
     $jevix->cfgSetTagCutWithContent(array('script', 'object', 'iframe', 'style'));
     // 5. Устанавливаем разрешённые параметры тегов. Также можно устанавливать допустимые значения этих параметров.
     $jevix->cfgAllowTagParams('a', array('title', 'href', 'class'));
     $jevix->cfgAllowTagParams('img', array('src', 'alt' => '#text', 'title', 'align' => array('right', 'left', 'center'), 'width' => '#int', 'height' => '#int', 'hspace' => '#int', 'vspace' => '#int', 'class'));
     $jevix->cfgAllowTagParams('code', array('class'));
     $jevix->cfgAllowTagParams('p', array('align' => array('left', 'right', 'center')));
     $jevix->cfgAllowTagParams('pre', array('class'));
     // 6. Устанавливаем параметры тегов являющиеся обязяательными. Без них вырезает тег оставляя содержимое.
     $jevix->cfgSetTagParamsRequired('img', 'src');
     $jevix->cfgSetTagParamsRequired('a', 'href');
     // 7. Устанавливаем теги которые может содержать тег контейнер
     //    cfgSetTagChilds($tag, $childs, $isContainerOnly, $isChildOnly)
     //       $isContainerOnly : тег является только контейнером для других тегов и не может содержать текст (по умолчанию false)
     //       $isChildOnly : вложенные теги не могут присутствовать нигде кроме указанного тега (по умолчанию false)
     //$jevix->cfgSetTagChilds('ul', 'li', true, false);
     // 8. Устанавливаем атрибуты тегов, которые будут добавлятся автоматически
     $jevix->cfgSetTagParamDefault('a', 'rel', null, true);
     //$jevix->cfgSetTagParamsAutoAdd('a', array('rel' => 'nofollow'));
     //$jevix->cfgSetTagParamsAutoAdd('a', array('name'=>'rel', 'value' => 'nofollow', 'rewrite' => true));
     //        $jevix->cfgSetTagParamDefault('img', 'width', '300px');
     //        $jevix->cfgSetTagParamDefault('img', 'height', '300px');
     //$jevix->cfgSetTagParamsAutoAdd('img', array('width' => '300', 'height' => '300'));
     //$jevix->cfgSetTagParamsAutoAdd('img', array(array('name'=>'width', 'value' => '300'), array('name'=>'height', 'value' => '300') ));
     // 9. Устанавливаем автозамену
     $jevix->cfgSetAutoReplace(array(' -- ', '+/-', '(c)', '(r)'), array(' &mdash; ', '±', '©', '®'));
     // 10. Включаем или выключаем режим XHTML. (по умолчанию включен)
     $jevix->cfgSetXHTMLMode(TRUE);
     // 11. Включаем или выключаем режим замены переноса строк на тег <br/>. (по умолчанию включен)
     $jevix->cfgSetAutoBrMode(TRUE);
     // 12. Включаем или выключаем режим автоматического определения ссылок. (по умолчанию включен)
     $jevix->cfgSetAutoLinkMode(FALSE);
     // 13. Отключаем типографирование в определенном теге
     $jevix->cfgSetTagNoTypography(array('code', 'pre'));
     //        $jevix->cfgSetTagNoTypography('pre');
     event('jevix', $jevix);
     $errors = array();
     $result = $jevix->parse($value, $errors);
     return $result;
 }
Exemple #26
0
 /**
  * Add final point and show calculations for system benchmark
  */
 public function finalPoint()
 {
     $this->addPoint('system.end');
     if (access('development')) {
         $cogear = getInstance();
         $template = new Template('Dev.results');
         $template->data = Dev_Gear::humanize($cogear->dev->measurePoint('system'));
         append('footer', $template->render());
         js($this->folder . '/js/inline/debug.js');
     }
 }
 /**
  * @param $type
  * @param $text
  * @param null $entity_id
  * @param null $icon
  * @param null $class
  * @param null $assets
  * @return bool|static
  */
 public function log($type, $text, $entity_id = null, $icon = null, $class = null, $assets = null)
 {
     //Type can be id or name
     if (!is_numeric($type)) {
         $type = HistoryType::where('name', $type)->first();
     }
     if ($type instanceof HistoryType) {
         return History::create(['type_id' => $type->id, 'text' => $text, 'user_id' => access()->id(), 'entity_id' => $entity_id, 'icon' => $icon, 'class' => $class, 'assets' => is_array($assets) && count($assets) ? json_encode($assets) : null]);
     }
     return false;
 }
 public function getUserOrganizationsIds()
 {
     $organizations = access()->user()->organizations()->get();
     $ids = '(';
     foreach ($organizations as $organization) {
         $ids .= $organization->id . ',';
     }
     $ids = trim($ids, ',');
     $ids .= ')';
     return $ids;
 }
Exemple #29
0
 /**
  * Add Control Panel to user panel
  */
 public function hookMenu($name, $menu)
 {
     switch ($name) {
         case 'admin':
             $menu->add(array('label' => icon('home'), 'link' => l('/admin'), 'active' => check_route('admin$') or check_route('^admin/dashboard'), 'order' => 0, 'elements' => array(array('link' => l('/admin'), 'label' => icon('home') . ' ' . t('Главная')), array('link' => l('/admin/clear/session'), 'label' => icon('remove') . ' ' . t('Сбросить сессию'), 'order' => '0.1'), array('link' => l('/admin/clear/cache'), 'label' => icon('trash') . ' ' . t('Сбросить кеш'), 'access' => access('Admin'), 'order' => '0.2'))));
             $counter = config('admin.update.counter', 0);
             $menu->add(array('label' => icon('refresh') . ' ' . t('Обновления') . ($counter ? badge($counter) : ''), 'title' => t('Обновления'), 'link' => l('/admin/update'), 'order' => 1001));
             $menu->add(array('link' => l('/admin/site'), 'label' => icon('inbox') . ' ' . t('Сайт'), 'order' => 1000));
             break;
     }
 }
 /**
  * @param RegisterRequest $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function register(RegisterRequest $request)
 {
     if (config('access.users.confirm_email')) {
         $user = $this->user->create($request->all());
         event(new UserRegistered($user));
         return redirect($this->redirectPath())->withFlashSuccess(trans('exceptions.frontend.auth.confirmation.created_confirm'));
     } else {
         auth()->login($this->user->create($request->all()));
         event(new UserRegistered(access()->user()));
         return redirect($this->redirectPath());
     }
 }