mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Merge branch 'dillon/63.3-sorry-voucher-debug' into 'master'
Sorry Voucher Implementation - temporary work around on 403 issue, backend permission issue See merge request CIEFWorldwideSdnBhd/exchange-2.0!168
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Classes\Modules\Vouchers\Standards\Rules;
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use App\Classes\Modules\Vouchers\Standards\Validators\VoucherValidation;
|
||||
use App\Classes\Modules\Vouchers\DataTransferObjects\CreateVoucherObject;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Classes\ValueObjects\Constants\Vouchers;
|
||||
|
||||
@@ -34,7 +35,8 @@ class CanCreateVoucher extends AbstractRule
|
||||
case Vouchers::SORRY_50:
|
||||
case Vouchers::SORRY_100:
|
||||
case Vouchers::SORRY_200:
|
||||
$isAuthorized = Auth::user()->can('add voucher');
|
||||
// $isAuthorized = Auth::user()->can('add voucher');
|
||||
$isAuthorized = in_array(Auth::user()->type, RoleTypes::ADMIN_ROLES);
|
||||
break;
|
||||
default:
|
||||
$isAuthorized = true;
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace App\Classes\Modules\Vouchers\Standards\Rules;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractRule;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Classes\ValueObjects\Constants\RoleTypes;
|
||||
|
||||
class CanListVoucherCampaigns extends AbstractRule
|
||||
{
|
||||
@@ -14,63 +14,8 @@ class CanListVoucherCampaigns extends AbstractRule
|
||||
*/
|
||||
protected function authorized($object): bool
|
||||
{
|
||||
Log::info('view document: ' . Auth::user()->can('view document'));
|
||||
Log::info('add document: ' . Auth::user()->can('add document'));
|
||||
Log::info('edit document: ' . Auth::user()->can('edit document'));
|
||||
Log::info('delete document: ' . Auth::user()->can('delete document'));
|
||||
|
||||
Log::info('view standard_segment: ' . Auth::user()->can('view standard_segment'));
|
||||
Log::info('add standard_segment: ' . Auth::user()->can('add standard_segment'));
|
||||
Log::info('edit standard_segment: ' . Auth::user()->can('edit standard_segment'));
|
||||
Log::info('delete standard_segment: ' . Auth::user()->can('delete standard_segment'));
|
||||
|
||||
Log::info('view standard_segment_constant: ' . Auth::user()->can('view standard_segment_constant'));
|
||||
Log::info('add standard_segment_constant: ' . Auth::user()->can('add standard_segment_constant'));
|
||||
Log::info('edit standard_segment_constant: ' . Auth::user()->can('edit standard_segment_constant'));
|
||||
Log::info('delete standard_segment_constant: ' . Auth::user()->can('delete standard_segment_constant'));
|
||||
|
||||
Log::info('view segment: ' . Auth::user()->can('view segment'));
|
||||
Log::info('add segment: ' . Auth::user()->can('add segment'));
|
||||
Log::info('edit segment: ' . Auth::user()->can('edit segment'));
|
||||
Log::info('delete segment: ' . Auth::user()->can('delete segment'));
|
||||
|
||||
Log::info('view segment_constant: ' . Auth::user()->can('view segment_constant'));
|
||||
Log::info('add segment_constant: ' . Auth::user()->can('add segment_constant'));
|
||||
Log::info('edit segment_constant: ' . Auth::user()->can('edit segment_constant'));
|
||||
Log::info('delete segment_constant: ' . Auth::user()->can('delete segment_constant'));
|
||||
|
||||
Log::info('view company_bank: ' . Auth::user()->can('view company_bank'));
|
||||
Log::info('add company_bank: ' . Auth::user()->can('add company_bank'));
|
||||
Log::info('edit company_bank: ' . Auth::user()->can('edit company_bank'));
|
||||
Log::info('delete company_bank: ' . Auth::user()->can('delete company_bank'));
|
||||
|
||||
Log::info('view currency: ' . Auth::user()->can('view currency'));
|
||||
Log::info('add currency: ' . Auth::user()->can('add currency'));
|
||||
Log::info('edit currency: ' . Auth::user()->can('edit currency'));
|
||||
Log::info('delete currency: ' . Auth::user()->can('delete currency'));
|
||||
|
||||
Log::info('view currency_rate: ' . Auth::user()->can('view currency_rate'));
|
||||
Log::info('add currency_rate: ' . Auth::user()->can('add currency_rate'));
|
||||
Log::info('edit currency_rate: ' . Auth::user()->can('edit currency_rate'));
|
||||
Log::info('delete currency_rate: ' . Auth::user()->can('delete currency_rate'));
|
||||
|
||||
Log::info('view booking: ' . Auth::user()->can('view booking'));
|
||||
Log::info('add booking: ' . Auth::user()->can('add booking'));
|
||||
Log::info('edit booking: ' . Auth::user()->can('edit booking'));
|
||||
Log::info('delete booking: ' . Auth::user()->can('delete booking'));
|
||||
|
||||
Log::info('add milestone: ' . Auth::user()->can('add milestone'));
|
||||
Log::info('add reward: ' . Auth::user()->can('add reward'));
|
||||
Log::info('edit milestone: ' . Auth::user()->can('edit milestone'));
|
||||
Log::info('delete milestone: ' . Auth::user()->can('delete milestone'));
|
||||
Log::info('delete reward: ' . Auth::user()->can('delete reward'));
|
||||
|
||||
Log::info('add voucher: ' . Auth::user()->can('add voucher'));
|
||||
Log::info('list voucher campaigns: ' . Auth::user()->can('list voucher campaigns'));
|
||||
Log::info('update bank_metadata: ' . Auth::user()->can('update bank_metadata'));
|
||||
|
||||
|
||||
if (!Auth::user()->can('list voucher campaigns')) {
|
||||
// if (!Auth::user()->can('list voucher campaigns')) {
|
||||
if (!in_array(Auth::user()->type, RoleTypes::ADMIN_ROLES)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user