Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function deleteNumber(Request $request, $numberId)
{
$data = $request->json()->all();
$number = DIDNumber::where('public_id', '=', $numberId)->firstOrFail();
if (!$this->hasPermissions($request, $number, 'manage_dids')) {
if (!$this->hasPermissions($request, $number, 'delete_did')) {
return $this->response->errorForbidden();
}
//add unrenting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function deleteExtension(Request $request, $extensionId)
$data = $request->all();
$workspace = $this->getWorkspace($request);
$extension = Extension::where('public_id', '=', $extensionId)->firstOrFail();
if (!$this->hasPermissions($request, $extension, 'manage_extensions')) {
if (!$this->hasPermissions($request, $extension, 'delete_extension')) {
return $this->response->errorForbidden();
}
$user = $this->getUser($request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function deleteTrunk(Request $request, $trunkId)
$data = $request->json()->all();
$trunk = SIPTrunk::where('public_id', $trunkId)->firstOrFail();
$user = $this->getUser($request);
if (!$this->hasPermissions($request, $trunk, 'manage_trunks')) {
if (!$this->hasPermissions($request, $trunk, 'delete_trunk')) {
return $this->response->errorForbidden();
}
$term_settings = SIPTrunkTermination::where('trunk_id', $trunk->id)->firstOrFail();
Expand Down
4 changes: 2 additions & 2 deletions app/app/Helpers/WorkspaceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public static function canPerformAction($user, $workspace, $action) {
case 'manage_trunks':
return $settings->manage_trunks;
break;
case 'create_trunks':
return $settings->create_trunks;
case 'create_trunk':
return $settings->create_trunk;
break;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function listCarriers(Request $request)
public function deleteCarrier(Request $request, $carrierId)
{
$carrier = BYOCarrier::where('public_id', $carrierId)->firstOrFail();
if (!$this->hasPermissions($request, $carrier, 'manage_byo_carriers')) {
if (!$this->hasPermissions($request, $carrier, 'delete_byo_carrier')) {
return $this->response->errorForbidden();
}
$carrier->delete();
Expand Down
2 changes: 1 addition & 1 deletion app/app/Http/Controllers/Api/Flow/FlowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function deleteFlow(Request $request, $flowId)
{
$data = $request->json()->all();
$flow = Flow::findOrFail($flowId);
if (!$this->hasPermissions($request, $flow, 'manage_flows')) {
if (!$this->hasPermissions($request, $flow, 'delete_flow')) {
return $this->response->errorForbidden();
}
$flow->delete();
Expand Down
2 changes: 1 addition & 1 deletion app/app/Http/Controllers/Api/Phone/PhoneController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function listPhones(Request $request)
public function deletePhone(Request $request, $phoneId)
{
$phone = Phone::findOrFail($phoneId);
if (!$this->hasPermissions($request, $phone, 'manage_phones')) {
if (!$this->hasPermissions($request, $phone, 'delete_phone')) {
return $this->response->errorForbidden();
}
$phone->delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function listPhoneGlobalSettings(Request $request)
public function deletePhoneGlobalSetting(Request $request, $phoneSettingId)
{
$phoneSettings = PhoneGlobalSetting::findOrFail($phoneSettingId);
if (!$this->hasPermissions($request, $phoneSettings, 'manage_phoneglobalsettings')) {
if (!$this->hasPermissions($request, $phoneSettings, 'delete_phoneglobalsetting')) {
return $this->response->errorForbidden();
}
$phoneSettings->delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function listPhoneGroups(Request $request)
public function deletePhoneGroup(Request $request, $phoneGroupId)
{
$phoneGroup = PhoneGroup::findOrFail($phoneGroupId);
if (!$this->hasPermissions($request, $phoneGroup, 'manage_phonegroups')) {
if (!$this->hasPermissions($request, $phoneGroup, 'delete_phonegroup')) {
return $this->response->errorForbidden();
}
$phoneGroup->delete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function listPhoneIndividualSettings(Request $request)
public function deletePhoneIndividualSetting(Request $request, $phoneSettingId)
{
$phoneSettings = PhoneIndividualSetting::findOrFail($phoneSettingId);
if (!$this->hasPermissions($request, $phoneSettings, 'manage_phoneindividualsettings')) {
if (!$this->hasPermissions($request, $phoneSettings, 'delete_phoneindividualsetting')) {
return $this->response->errorForbidden();
}
$phoneSettings->delete();
Expand Down
4 changes: 2 additions & 2 deletions app/app/WorkspaceUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class WorkspaceUser extends PublicResource {
'manage_byo_did_numbers' => 'bool',
'create_byo_did_number' => 'bool',
'manage_trunks' => 'bool',
'create_trunks' => 'bool',
'create_trunk' => 'bool',



Expand Down Expand Up @@ -85,7 +85,7 @@ class WorkspaceUser extends PublicResource {
'manage_byo_did_numbers',
'create_byo_did_number',
'manage_trunks',
'create_trunks'
'create_trunk'

];
public static function createSuperAdmin($workspace, $user, $extras=[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function up()
{
Schema::table('workspaces_users', function (Blueprint $table) {
//
$table->boolean('create_trunks');
$table->boolean('create_trunk');
$table->boolean('manage_trunks');
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function up()
$table->boolean('delete_phoneindividualsetting')->default(0)->after('create_phoneindividualsetting');
$table->boolean('delete_byo_carrier')->default(0)->after('create_byo_carrier');
$table->boolean('delete_byo_did_number')->default(0)->after('create_byo_did_number');
$table->boolean('delete_trunks')->default(0)->after('create_trunks');
$table->boolean('delete_trunk')->default(0)->after('create_trunk');
});
}

Expand All @@ -47,7 +47,7 @@ public function down()
'delete_phoneindividualsetting',
'delete_byo_carrier',
'delete_byo_did_number',
'delete_trunks'
'delete_trunk'
]);
});
}
Expand Down
Loading