Ejemplo n.º 1
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (Auth::check() && Auth::user()->hasAccess('create_paper')) {
         return true;
     }
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (\Auth::user()->isModerator()) {
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('id');
     if ($id == 0) {
         return TRUE;
     }
     return \Auth::user()->owns(\App\AmazonProduct::find($id));
 }
Ejemplo n.º 4
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (\Auth::user()->level->id == 1) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $profile = $this->route('profiles');
     if (!is_null($user = \Auth::user())) {
         return $user->is_admin || !is_null($user->profile) && $user->profile->id == $profile;
     }
     return false;
 }
Ejemplo n.º 6
0
 /**
  * Check when user updates details, that if email has changed it is not taken by another user.
  */
 public function validator()
 {
     $validator = Validator::make($this->input(), $this->rules(), $this->messages());
     $validator->sometimes('email', 'unique:users', function ($input) {
         return $input->email != \Auth::user()->email;
     });
     return $validator;
 }
Ejemplo n.º 7
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $user = \Auth::user();
     if ($user->hasRoles(['admin', 'super admin'])) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 8
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $user = Auth::user();
     $group_id = $this->route('group');
     // Есть ли права на запись
     // является ли пользователь админом
     // и админ ли он этой группы
     return $user->is_admin && GroupAdmin::where('admin_id', $user->id)->where('group_id', $group_id)->exists();
 }
Ejemplo n.º 9
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $reportId = $this->route('id');
     $report = ExpenseReport::find($reportId);
     if ($report->owner_id == \Auth::user()->id) {
         return true;
     }
     return false;
 }
Ejemplo n.º 10
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $reportId = $this->route('id');
     $report = ExpenseReport::findOrFail($reportId);
     if ($report->users()->get(['id'])->contains(\Auth::user()->id) || $report->owner_id == \Auth::user()->id) {
         return true;
     }
     return false;
 }
Ejemplo n.º 11
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (isset(\Auth::user()->site_id)) {
         $sites_ids = SiteLanguages::site_access()->select(\DB::raw(' GROUP_CONCAT(id) as sites_ids'))->groupBy('sites_id')->get();
         $site_access = 'in:' . $sites_ids[0]->sites_ids;
     } else {
         $site_access = '';
     }
     return ['sitelanguages_id' => 'required|' . $site_access, 'title' => 'required|unique:topmenus,title,' . $this->topmenus, 'link' => 'required'];
 }
Ejemplo n.º 12
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (isset(\Auth::user()->site_id)) {
         $sites_ids = SiteLanguages::site_access()->select(\DB::raw(' GROUP_CONCAT(id) as sites_ids'))->groupBy('sites_id')->get();
         $site_access = 'in:' . $sites_ids[0]->sites_ids;
     } else {
         $site_access = '';
     }
     return ['title' => 'required', 'slug' => 'required', 'text' => 'required', 'sitelanguages_id' => 'required|' . $site_access, 'meta_keywords' => 'required', 'meta_description' => 'required'];
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $id = $this->route('id');
     if ($id == 0) {
         return TRUE;
     }
     $transactionItem = \App\TransactionItem::find($id);
     if (!$transactionItem) {
         return TRUE;
     }
     return \Auth::user()->owns($transactionItem->transaction->customer);
 }
Ejemplo n.º 14
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return \Auth::user()->can('destroy home') ? true : null;
         case 'POST':
             return \Auth::user()->can('store home') ? true : null;
         case 'PUT':
         case 'PATCH':
             return \Auth::user()->can('update home') ? true : null;
         default:
             break;
     }
 }
Ejemplo n.º 15
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     /**
      *  check security in frontend  site language for any users
      *
      * @return string
      */
     if (isset(\Auth::user()->site_id)) {
         $sites_ids = SiteLanguages::site_access()->select(\DB::raw(' GROUP_CONCAT(id) as sites_ids'))->groupBy('sites_id')->get();
         $site_access = 'in:' . $sites_ids[0]->sites_ids;
     } else {
         $site_access = '';
     }
     return ['sitelanguages_id' => 'required|' . $site_access, 'slug' => 'required|unique:news,slug', 'text' => 'required', 'meta_keywords' => 'required'];
 }
Ejemplo n.º 16
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $reportId = $this->route('reportId');
     if ($reportId == null) {
         $expenseId = $this->route('expenseId');
         $reportId = Expense::find($expenseId)->report_id;
     }
     $report = ExpenseReport::find($reportId);
     if ($report->status) {
         return false;
     }
     if ($report->users()->get(['id'])->contains(\Auth::user()->id) || $report->owner_id == \Auth::user()->id) {
         return true;
     }
     return false;
 }
Ejemplo n.º 17
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $type = strtolower(\Request::segment(2));
     switch ($this->method()) {
         case 'GET':
         case 'DELETE':
             return \Auth::user()->can('destroy ' . $type) ? true : null;
         case 'POST':
             return \Auth::user()->can('store ' . $type) ? true : null;
         case 'PUT':
         case 'PATCH':
             return \Auth::user()->can('update ' . $type) ? true : null;
         default:
             break;
     }
 }
Ejemplo n.º 18
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return \Auth::user()->can('manage_system');
 }
Ejemplo n.º 19
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return !empty(Auth::user()) && Auth::user()->hasRole('administrator');
 }
Ejemplo n.º 20
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['username' => 'required|unique:users,username,' . \Auth::user()->id, 'email' => 'required|email|unique:users,email,' . \Auth::user()->id, 'phone' => 'required', 'name' => 'required', 'password' => 'min:6', 'photo' => 'image|image_size:<=300'];
 }
Ejemplo n.º 21
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if (\Auth::user()->isAdmin()) {
         return true;
     }
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $site_access = isset(\Auth::user()->site_id) ? '|in:' . \Auth::user()->site_id : '';
     return ['sites_id' => 'required|exists:sites,id' . $site_access];
 }
 /**
  * @param Route $route
  */
 public function __construct(Route $route)
 {
     $this->route = $route;
     $this->course = $route->getParameter('courses');
     $this->user = \Auth::user()->id;
 }
Ejemplo n.º 24
0
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['name' => 'required|
                         unique:games,name,NULL,id,user_id,' . \Auth::user()->id, 'category_id' => 'required'];
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $user = \Auth::user();
     return ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users,email,' . $user->id, 'password' => 'required|confirmed|min:6'];
 }
Ejemplo n.º 26
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return \Auth::user()->isAdmin;
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $site_access = isset(\Auth::user()->site_id) ? '|in:' . \Auth::user()->site_id : '';
     return ['sites_id' => 'required|exists:sites,id' . $site_access . '|unique_with:sitelanguages,languages_id', 'languages_id' => 'required|exists:languages,id'];
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $grade = \Auth::user()->grades()->where('name', 'Lycée')->first()->name;
     return ['nom_enfant' => 'required|min:3', 'date_naissance' => 'required', 'photo' => 'image', 'nom_pere' => 'required|min:3', 'nom_mere' => 'required|min:3', 'email_responsable' => 'required|email', 'grade' => 'required|integer', 'cin' => 'required|alpha_num', 'classe' => 'required|integer'];
 }
Ejemplo n.º 29
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return (bool) (!\Auth::user()->team_id);
 }
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     return \Auth::user();
 }