Skip to content

Commit

Permalink
env() to config()
Browse files Browse the repository at this point in the history
  • Loading branch information
Kipjr committed Jun 27, 2024
1 parent d7647e2 commit d09544f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions app/Helpers/MSGraphAPI/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class User {

public function __construct()
{
$extension_app_id = Str::remove('-', env('AZURE_EXTENSION_APP_ID'));
$extension_app_id = Str::remove('-', config('service.azure.extension_app_id'));
$this->employeeNumberProperty = 'extension_' . $extension_app_id . '_employeeNumber';
$this->descriptionProperty = 'extension_' . $extension_app_id . '_description';
$this->mailProperty = 'extension_' . $extension_app_id . '_mail';
Expand Down Expand Up @@ -115,7 +115,7 @@ private function getApplicationRoles($token) {
# This is the unique ID of the service principal object associated with this application. This ID can be useful when performing management operations against this application using PowerShell or other programmatic interfaces.
# https://graph.microsoft.com/v1.0/servicePrincipals/12345/appRoleAssignedTo
# https://graph.microsoft.com/v1.0/servicePrincipals/12345?$select=appRoles
$endpoint = '/servicePrincipals/' . env('AZURE_SERVICEPRINCIPAL_ID');
$endpoint = '/servicePrincipals/' . config('service.azure.serviceprincipal_id');
$url = $endpoint . '?$select=appRoles';

//prepare request
Expand All @@ -129,9 +129,9 @@ private function getApplicationRoles($token) {
foreach ($content['appRoles'] as $key => $val) {
if($val['isEnabled'] == 'true'){
switch($val['value']){
case env('AZURE_ROLE_ADMIN_VALUE'):
case config('service.azure.role.admin'):
$this->RoleAdminId = $val['id']; break;
case env('AZURE_ROLE_USER_VALUE'):
case config('service.azure.role.user'):
$this->RoleUserId = $val['id']; break;
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ private function getUserRoleAssignments($token,$userId) {

//loop over content
foreach ($content['value'] as $key => $val) {
if($val['resourceId'] == env('AZURE_SERVICEPRINCIPAL_ID')) {
if($val['resourceId'] == config('service.azure.serviceprincipal_id')) {
switch($val['appRoleId']){
case $this->RoleUserId:
$this->isAdmin=False;break;
Expand Down
12 changes: 6 additions & 6 deletions app/Helpers/MSGraphAPI/UserByApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UserByApp {

public function __construct()
{
$extension_app_id = Str::remove('-', env('AZURE_EXTENSION_APP_ID'));
$extension_app_id = Str::remove('-', config('service.azure.extension_app_id'));
$this->employeeNumberProperty = 'extension_' . $extension_app_id . '_employeeNumber';
$this->descriptionProperty = 'extension_' . $extension_app_id . '_description';
$this->mailProperty = 'extension_' . $extension_app_id . '_mail';
Expand Down Expand Up @@ -132,7 +132,7 @@ private function getUserRoleAssignments($userId) {

//loop over content
foreach ($content['value'] as $key => $val) {
if($val['resourceId'] == env('AZURE_SERVICEPRINCIPAL_ID')) {
if($val['resourceId'] == config('service.azure.serviceprincipal_id')) {
switch($val['appRoleId']){
case $this->RoleUserId:
return False;
Expand All @@ -153,9 +153,9 @@ private function getApplicationRoles() {
$graph->setApiVersion("beta");
$graph->setAccessToken($token);
# This is the unique ID of the service principal object associated with this application. This ID can be useful when performing management operations against this application using PowerShell or other programmatic interfaces.
# https://graph.microsoft.com/v1.0/servicePrincipals/12345/appRoleAssignedTo
# https://graph.microsoft.com/v1.0/servicePrincipals/12345/appRoleAssignedTo
# https://graph.microsoft.com/v1.0/servicePrincipals/12456?$select=appRoles
$endpoint = '/servicePrincipals/' . env('AZURE_SERVICEPRINCIPAL_ID');
$endpoint = '/servicePrincipals/' . config('service.azure.serviceprincipal_id');
$url = $endpoint . '?$select=appRoles';

//prepare request
Expand All @@ -169,9 +169,9 @@ private function getApplicationRoles() {
foreach ($content['appRoles'] as $key => $val) {
if($val['isEnabled'] == 'true'){
switch($val['value']){
case env('AZURE_ROLE_ADMIN_VALUE'):
case config('service.azure.role.admin'):
$this->RoleAdminId = $val['id']; break;
case env('AZURE_ROLE_USER_VALUE'):
case config('service.azure.role.user'):
$this->RoleUserId = $val['id']; break;
}
}
Expand Down

0 comments on commit d09544f

Please sign in to comment.