Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
power
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
254
Issues
254
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pardeep Sahu
power
Commits
3e72b71b
Commit
3e72b71b
authored
3 years ago
by
Pardeep Sahu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
targets dealer restriction in url
parent
fe5f64fb
Pipeline
#2601
passed with stage
in 26 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
2 deletions
+33
-2
app/Http/Controllers/AsmController.php
app/Http/Controllers/AsmController.php
+1
-0
app/Http/Controllers/RsmController.php
app/Http/Controllers/RsmController.php
+1
-0
app/Http/Controllers/SseController.php
app/Http/Controllers/SseController.php
+1
-0
app/Http/Middleware/AuthenticateResource.php
app/Http/Middleware/AuthenticateResource.php
+15
-1
app/Http/helpers.php
app/Http/helpers.php
+14
-0
routes/web.php
routes/web.php
+1
-1
No files found.
app/Http/Controllers/AsmController.php
View file @
3e72b71b
...
...
@@ -1328,6 +1328,7 @@ class AsmController extends Controller
$query
->
where
(
'dealer_id'
,
$request
->
dealer_id
);
}
})
->
whereIn
(
'dealer_id'
,
$d_ids
)
->
whereYear
(
'month'
,
$year
)
->
whereMonth
(
'month'
,
$month
)
->
paginate
(
10
);
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/RsmController.php
View file @
3e72b71b
...
...
@@ -959,6 +959,7 @@ class RsmController extends Controller
$query
->
where
(
'dealer_id'
,
$request
->
dealer_id
);
}
})
->
whereIn
(
'dealer_id'
,
$d_ids
)
->
whereYear
(
'month'
,
$year
)
->
whereMonth
(
'month'
,
$month
)
->
paginate
(
10
);
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/SseController.php
View file @
3e72b71b
...
...
@@ -958,6 +958,7 @@ class SseController extends Controller
$query
->
where
(
'dealer_id'
,
$request
->
dealer_id
);
}
})
->
whereIn
(
'dealer_id'
,
$d_ids
)
->
whereYear
(
'month'
,
$year
)
->
whereMonth
(
'month'
,
$month
)
->
paginate
(
10
);
...
...
This diff is collapsed.
Click to expand it.
app/Http/Middleware/AuthenticateResource.php
View file @
3e72b71b
...
...
@@ -30,7 +30,21 @@ class AuthenticateResource
return
redirect
()
->
back
()
->
with
(
'error'
,
'Invalid activity'
);
}
}
$dealersArray
=
get_reporting_authorities_dealer
(
$loggedInUser
);
if
(
str_contains
(
$request
->
getRequestUri
(),
'asm/targets'
))
{
if
(
!
empty
(
request
()
->
dealer_id
)
&&
!
in_array
(
request
()
->
dealer_id
,
$dealersArray
))
{
return
redirect
()
->
back
()
->
with
(
'error'
,
'Invalid activity'
);
}
}
else
if
(
str_contains
(
$request
->
getRequestUri
(),
'rsm/targets'
))
{
if
(
!
empty
(
request
()
->
dealer_id
)
&&
!
in_array
(
request
()
->
dealer_id
,
$dealersArray
))
{
return
redirect
()
->
back
()
->
with
(
'error'
,
'Invalid activity'
);
}
}
else
if
(
str_contains
(
$request
->
getRequestUri
(),
'sse/targets'
))
{
if
(
!
empty
(
request
()
->
dealer_id
)
&&
!
in_array
(
request
()
->
dealer_id
,
$dealersArray
))
{
return
redirect
()
->
back
()
->
with
(
'error'
,
'Invalid activity'
);
}
}
return
$next
(
$request
);
}
}
This diff is collapsed.
Click to expand it.
app/Http/helpers.php
View file @
3e72b71b
...
...
@@ -487,6 +487,20 @@ function get_dealers($firm_id)
return
@
$result
;
}
//get asm
function
get_reporting_authorities_dealer
(
$user_id
)
{
$getDealers
=
DB
::
table
(
'users'
)
->
where
([
'role'
=>
2
,
'status'
=>
1
])
->
select
(
'id'
,
'name'
,
'reporting_authority'
)
->
orderBy
(
'name'
,
'asc'
)
->
get
();
$d_ids
=
array
();
foreach
(
$getDealers
as
$key
=>
$value
)
{
$authorities
=
explode
(
","
,
$getDealers
[
$key
]
->
reporting_authority
);
if
(
in_array
(
$user_id
,
$authorities
))
{
$d_ids
[]
=
$getDealers
[
$key
]
->
id
;
}
}
return
$d_ids
;
}
// get Firm short code
function
get_firm_short_code
(
$id
=
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
routes/web.php
View file @
3e72b71b
...
...
@@ -381,7 +381,7 @@ Route::group(['prefix' => 'asm', 'as' => 'asm::', 'middleware' => ['web', 'asm']
Route
::
get
(
'/statusEmpHierarchy/{status}/{id}'
,
'AsmController@statusEmpHierarchy'
);
// Target Module
Route
::
get
(
'targets'
,
'AsmController@targets'
);
Route
::
get
(
'targets'
,
'AsmController@targets'
)
->
middleware
(
'authenticate'
)
;
Route
::
get
(
'targetListing/{dealer_id}/{temp_id}/{target_id}'
,
'AsmController@targetListing'
);
Route
::
get
(
'editTarget/{target_id}'
,
'AsmController@editTarget'
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment