Skip to content

Commit

Permalink
Fix code logic in admin controllers (#45037)
Browse files Browse the repository at this point in the history
joomdonation authored Feb 28, 2025
1 parent 76918b0 commit e016edc
Showing 10 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;
$categoryId = 0;

if ($recordId) {
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'parent_id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;
$user = $this->app->getIdentity();

// Check "edit" permission on record asset (explicit or inherited)
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;

// Since there is no asset tracking, fallback to the component permissions.
if (!$recordId) {
Original file line number Diff line number Diff line change
@@ -159,7 +159,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;
$user = $this->app->getIdentity();

// Zero record (id:0), return component edit permission by calling parent controller method
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;
$user = $this->app->getIdentity();

// Zero record (id:0), return component edit permission by calling parent controller method
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'parent_id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;
$user = $this->app->getIdentity();

// Zero record (parent_id:0), return component edit permission by calling parent controller method
Original file line number Diff line number Diff line change
@@ -141,7 +141,7 @@ protected function allowSave($data, $key = 'id')
protected function allowEdit($data = [], $key = 'id')
{
// Initialise variables.
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;

// Zero record (id:0), return component edit permission by calling parent controller method
if (!$recordId) {
Original file line number Diff line number Diff line change
@@ -68,7 +68,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;

// Since there is no asset tracking, fallback to the component permissions.
if (!$recordId) {
Original file line number Diff line number Diff line change
@@ -344,7 +344,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;

if (!$recordId) {
return false;
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ protected function allowAdd($data = [])
*/
protected function allowEdit($data = [], $key = 'id')
{
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$recordId = isset($data[$key]) ? (int) $data[$key] : 0;
$user = $this->app->getIdentity();

// Zero record (id:0), return component edit permission by calling parent controller method

0 comments on commit e016edc

Please sign in to comment.