Esempio n. 1
0
 /**
  * Static method to check if the account has access to the model instance.
  *
  * @param int                     $model_id
  * @param \AbuseIO\Models\Account $account
  *
  * @return bool
  */
 public static function checkAccountAccess($model_id, Account $account)
 {
     // Early return when we are in the system account
     if ($account->isSystemAccount()) {
         return true;
     }
     $domain = self::find($model_id);
     return $domain->contact->account->id == $account->id;
 }
Esempio n. 2
0
 /**
  * Static method to check if the account has access to the model instance.
  *
  * @param  $model_id                        Model Id
  * @param \AbuseIO\Models\Account $account The Account Model
  *
  * @return bool
  */
 public static function checkAccountAccess($model_id, Account $account)
 {
     // Early return when we are in the system account
     if ($account->isSystemAccount()) {
         return true;
     }
     $ticket = self::find($model_id);
     $allowed = $ticket->ip_contact_account_id == $account->id || $ticket->domain_contact_account_id == $account->id;
     return $allowed;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param Account $account
  *
  * @return \\Illuminate\Http\RedirectResponse
  */
 public function destroy(Account $account)
 {
     $brand = $account->brand;
     if (!$account->mayDestroy($this->auth_user)) {
         return Redirect::route('admin.accounts.index')->with('message', 'User is not authorized to edit this account.');
     }
     // Do not allow the system admin user account to be deleted.
     if ($account->isSystemAccount()) {
         return Redirect::back()->with('message', 'Not allowed to delete the default admin account.');
     }
     // delete the linked users
     foreach ($account->users as $user) {
         $user->delete();
     }
     // delete the account
     $account->delete();
     // delete the brand
     if ($brand->canDelete()) {
         $brand->delete();
     }
     return Redirect::route('admin.accounts.index')->with('message', 'Account and it\'s related users and brands have been deleted.');
 }
Esempio n. 4
0
 /**
  * Static method to check if the account has access to the model instance.
  *
  * @param int                     $model_id
  * @param \AbuseIO\Models\Account $account
  *
  * @return bool
  */
 public static function checkAccountAccess($model_id, Account $account)
 {
     // Early return when we are in the system account
     if ($account->isSystemAccount()) {
         return true;
     }
     // Get all tickets related to this evidence
     $tickets = self::find($model_id)->tickets;
     // If tickets ip or domain contact is the same as current account
     // then allow access to this evidence
     foreach ($tickets as $ticket) {
         if ($ticket->ip_contact_account_id == $account->id || $ticket->domain_contact_account_id == $account->id) {
             return true;
         }
     }
     return false;
 }
Esempio n. 5
0
 /**
  * Static method to check if the account has access to the model instance.
  *
  * @param int                     $model_id
  * @param \AbuseIO\Models\Account $account
  *
  * @return bool
  */
 public static function checkAccountAccess($model_id, Account $account)
 {
     // Early return when we are in the system account
     if ($account->isSystemAccount()) {
         return true;
     }
     $user = self::find($model_id);
     $allowed = $user->account_id == $account->id;
     return $allowed;
 }