backend/controllers/UsersController.php
/**
     * Finds the UserFiles model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param string $file_id
     * @return UserFiles the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     * @throws ForbiddenHttpException if the model cannot be accessed
     */
Finds the UserFiles model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param string $file_id
@return UserFiles the loaded model
@throws NotFoundHttpException if the model cannot be found
@throws ForbiddenHttpException if the model cannot be accessed
Finds the UserFiles model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . @param string $file_id @return UserFiles the loaded model @throws NotFoundHttpException if the model cannot be found @throws ForbiddenHttpException if the model cannot be accessed
protected function findFile($file_id)
    {
        if (($model = UserFiles::findOne(['file_id' => $file_id])) !== null) {
            if ($this->Admins->admin_role != Admins::ROLE_ROOT) {
                $userModel = $model->getUser()->one();
                if ($this->Admins->admin_id != $userModel->user_ref_id) {
                    throw new ForbiddenHttpException("You don't have permissions for this action.");
                }
            }
            return $model;
        } else {
            throw new NotFoundHttpException('The requested page does not exist.');
        }
    }
protected function findFile ( $ file_id ) { if ( ( $ model = UserFiles :: findOne ( [ 'file_id' => $ file_id ] ) ) !== null ) { if ( $ this -> Admins -> admin_role != Admins :: ROLE_ROOT ) { $ userModel = $ model -> getUser ( ) -> one ( ) ; if ( $ this -> Admins -> admin_id != $ userModel -> user_ref_id ) { throw new ForbiddenHttpException ( " You don't have permissions for this action. " ) ; } } return $ model ; } else { throw new NotFoundHttpException ( 'The requested page does not exist.' ) ; } }
Finds the UserFiles model based on its primary key value.
Finds the UserFiles model based on its primary key value .
/** @var \common\models\Users $userModel */