AdminAccessController
extends AdminHttpViewController
in package
Class AdminAccessController
Tags
Table of Contents
- $adminAccessService : AdminAccessService
- $assets : AssetCollectionInterface
- $contentView : ContentViewInterface
- $db : CI_DB_query_builder
- $httpContextReader : HttpContextReaderInterface
- $httpResponseProcessor : HttpResponseProcessorInterface
- $languageProvider : LanguageProvider
- $postDataArray : array<string|int, mixed>
- $queryParametersArray : array<string|int, mixed>
- $serverDataArray : array<string|int, mixed>
- $templatePath : string
- $languageTextManager : LanguageTextManager
- __construct() : mixed
- actionAssignRoles() : RedirectHttpControllerResponse
- Saves the assignment of the roles and redirects to the role assignment page.
- actionDefault() : AdminLayoutHttpControllerResponse
- Default actions.
- actionEditAdmin() : AdminLayoutHttpControllerResponse
- Renders the admin access to edit the admins.
- actionManageAdmins() : AdminLayoutHttpControllerResponse
- Renders the admin access to manage the admins.
- actionManagePermissions() : AdminLayoutHttpControllerResponse
- Renders the admin access to edit the roles.
- actionManageRoles() : AdminLayoutHttpControllerResponse
- Renders the admin access to manage the admins.
- actionSavePermissions() : RedirectHttpControllerResponse
- Saves the granted and revoked permissions and redirects to the permission management page.
- init() : mixed
- Initialize Controller
- proceed() : mixed
- Processes a http response object which is get by invoking an action method.
- validateCurrentAdminStatus() : mixed
- Makes sure that the admin status is currently given in session
- _appendGroupChildrenToGroupsArray() : mixed
- Appends group children to a given group array.
- _callActionMethod() : HttpControllerResponseInterface
- Invokes an action method by the given action name.
- _createContentNavigation() : ContentNavigationCollection
- Creates the content navigation object for the admin access pages.
- _getAdminById() : array<string|int, mixed>
- Returns the db data for an admin by its given id.
- _getAdminEditsListElementActions() : array<string|int, mixed>
- Returns the necessary information to provide the elements actions for the admin edit page.
- _getAdminEditsListItems() : array<string|int, mixed>
- Returns the necessary information of the admin roles for the admin edit page.
- _getAdminsOverviewsListElementActions() : array<string|int, mixed>
- Returns the necessary information to provide the elements actions for the admins overview listing.
- _getAdminsOverviewsListItems() : array<string|int, mixed>
- Returns the necessary information of all admins to generate the overview listing.
- _getAssets() : AssetCollection
- Returns the assets for the admin access pages.
- _getGlobalPermissonsOverviewListItems() : array<string|int, mixed>
- Returns the necessary information of all global role permissions to generate the overview listing, such as API access and Gambio Admin Web UI access
- _getPermissionOverviewsGroupCollection() : AdminAccessGroupCollection
- Returns the necessary group collection with the right sorting to generate the permission overview listing.
- _getPermissionsOverviewsListItems() : array<string|int, mixed>
- Returns the necessary information of all role permissions to generate the overview listing.
- _getPostData() : string|null
- Returns the expected $_POST value by the given key name.
- _getPostDataCollection() : KeyValueCollection
- Creates and returns a key value collection which represent the global $_POST array.
- _getQueryParameter() : mixed|null
- Returns the expected $_GET value by the given key name.
- _getQueryParametersCollection() : KeyValueCollection
- Creates and returns a key value collection which represent the global $_GET array.
- _getRoleById() : array<string|int, mixed>
- Returns the db data for an role by its given id.
- _getRolesOverviewsListAction() : array<string|int, mixed>
- Returns the necessary information to provide the action for the roles overview listing.
- _getRolesOverviewsListItems() : array<string|int, mixed>
- Returns the necessary information of all admin roles to generate the overview listing.
- _getServerData() : string|null
- Returns the expected $_SERVER value by the given key name.
- _grantAllPermissionsForRole() : mixed
- Grants all permission to a given role.
- _render() : string
- Renders and returns a template file.
- _returnHttpResponse() : AdminLayoutHttpControllerResponse
- Creates and returns an AdminLayoutHttpControllerResponse.
- _updateAssignedRolesForAdmin() : mixed
- Saves the the given role assignments of an admin.
- _updatePermissionsForRole() : mixed
- Updates the given permissions of an admin.
- _updateUnknownPermissionsForRole() : mixed
- Updates the permission for unknown groups of a role by a given value.
- _validatePageToken() : mixed
- Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
- getTemplateFile() : ExistingFile
- Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
- isValidJson() : bool
- isValidRequestMethod() : bool
- prepareJsonInput() : array<string|int, mixed>
Properties
$adminAccessService
protected
AdminAccessService
$adminAccessService
$assets
protected
AssetCollectionInterface
$assets
$contentView
protected
ContentViewInterface
$contentView
$db
protected
CI_DB_query_builder
$db
$httpContextReader
protected
HttpContextReaderInterface
$httpContextReader
$httpResponseProcessor
protected
HttpResponseProcessorInterface
$httpResponseProcessor
$languageProvider
protected
LanguageProvider
$languageProvider
$postDataArray
protected
array<string|int, mixed>
$postDataArray
$queryParametersArray
protected
array<string|int, mixed>
$queryParametersArray
$serverDataArray
protected
array<string|int, mixed>
$serverDataArray
$templatePath
protected
string
$templatePath
$languageTextManager
private
LanguageTextManager
$languageTextManager
Methods
__construct()
public
__construct(HttpContextReaderInterface $httpContextReader, HttpResponseProcessorInterface $httpResponseProcessor, ContentViewInterface $defaultContentView) : mixed
Parameters
- $httpContextReader : HttpContextReaderInterface
- $httpResponseProcessor : HttpResponseProcessorInterface
- $defaultContentView : ContentViewInterface
Return values
mixed —actionAssignRoles()
Saves the assignment of the roles and redirects to the role assignment page.
public
actionAssignRoles() : RedirectHttpControllerResponse
Return values
RedirectHttpControllerResponse —actionDefault()
Default actions.
public
actionDefault() : AdminLayoutHttpControllerResponse
Return values
AdminLayoutHttpControllerResponse —actionEditAdmin()
Renders the admin access to edit the admins.
public
actionEditAdmin() : AdminLayoutHttpControllerResponse
Return values
AdminLayoutHttpControllerResponse —actionManageAdmins()
Renders the admin access to manage the admins.
public
actionManageAdmins() : AdminLayoutHttpControllerResponse
Return values
AdminLayoutHttpControllerResponse —actionManagePermissions()
Renders the admin access to edit the roles.
public
actionManagePermissions() : AdminLayoutHttpControllerResponse
Return values
AdminLayoutHttpControllerResponse —actionManageRoles()
Renders the admin access to manage the admins.
public
actionManageRoles() : AdminLayoutHttpControllerResponse
Return values
AdminLayoutHttpControllerResponse —actionSavePermissions()
Saves the granted and revoked permissions and redirects to the permission management page.
public
actionSavePermissions() : RedirectHttpControllerResponse
Return values
RedirectHttpControllerResponse —init()
Initialize Controller
public
init() : mixed
Return values
mixed —proceed()
Processes a http response object which is get by invoking an action method.
public
proceed(HttpContextInterface $httpContext) : mixed
The action method is determined by the http context reader instance and the current request context. Re-implement this method in child classes to enable XSS and CSRF protection on demand.
Parameters
- $httpContext : HttpContextInterface
-
Http context object which hold the request variables.
Tags
Return values
mixed —validateCurrentAdminStatus()
Makes sure that the admin status is currently given in session
public
validateCurrentAdminStatus() : mixed
Tags
Return values
mixed —_appendGroupChildrenToGroupsArray()
Appends group children to a given group array.
protected
_appendGroupChildrenToGroupsArray(array<string|int, mixed> $children, array<string|int, mixed> &$groupsArray, int $parentId) : mixed
Parameters
- $children : array<string|int, mixed>
- $groupsArray : array<string|int, mixed>
- $parentId : int
Return values
mixed —_callActionMethod()
Invokes an action method by the given action name.
protected
_callActionMethod(string $actionName) : HttpControllerResponseInterface
Parameters
- $actionName : string
-
Name of action method to call, without 'action'-Suffix.
Tags
Return values
HttpControllerResponseInterface —Response message.
_createContentNavigation()
Creates the content navigation object for the admin access pages.
protected
_createContentNavigation([string $currentSection = '' ]) : ContentNavigationCollection
Parameters
- $currentSection : string = ''
-
Defines the current navigation item.
Return values
ContentNavigationCollection —_getAdminById()
Returns the db data for an admin by its given id.
protected
_getAdminById(int $adminId) : array<string|int, mixed>
Parameters
- $adminId : int
Return values
array<string|int, mixed> —_getAdminEditsListElementActions()
Returns the necessary information to provide the elements actions for the admin edit page.
protected
_getAdminEditsListElementActions() : array<string|int, mixed>
Return values
array<string|int, mixed> —_getAdminEditsListItems()
Returns the necessary information of the admin roles for the admin edit page.
protected
_getAdminEditsListItems(mixed $adminId) : array<string|int, mixed>
Parameters
- $adminId : mixed
Return values
array<string|int, mixed> —_getAdminsOverviewsListElementActions()
Returns the necessary information to provide the elements actions for the admins overview listing.
protected
_getAdminsOverviewsListElementActions() : array<string|int, mixed>
Return values
array<string|int, mixed> —_getAdminsOverviewsListItems()
Returns the necessary information of all admins to generate the overview listing.
protected
_getAdminsOverviewsListItems() : array<string|int, mixed>
Return values
array<string|int, mixed> —_getAssets()
Returns the assets for the admin access pages.
protected
_getAssets() : AssetCollection
Return values
AssetCollection —_getGlobalPermissonsOverviewListItems()
Returns the necessary information of all global role permissions to generate the overview listing, such as API access and Gambio Admin Web UI access
protected
_getGlobalPermissonsOverviewListItems( $roleId) : array<string|int, mixed>
Parameters
Tags
Return values
array<string|int, mixed> —_getPermissionOverviewsGroupCollection()
Returns the necessary group collection with the right sorting to generate the permission overview listing.
protected
_getPermissionOverviewsGroupCollection() : AdminAccessGroupCollection
Return values
AdminAccessGroupCollection —_getPermissionsOverviewsListItems()
Returns the necessary information of all role permissions to generate the overview listing.
protected
_getPermissionsOverviewsListItems(int $roleId) : array<string|int, mixed>
Parameters
- $roleId : int
Tags
Return values
array<string|int, mixed> —_getPostData()
Returns the expected $_POST value by the given key name.
protected
_getPostData(string $keyName) : string|null
This method is the object oriented layer for $_POST[$keyName].
Parameters
- $keyName : string
-
Expected key of post parameter.
Return values
string|null —Either the expected value or null, of not found.
_getPostDataCollection()
Creates and returns a key value collection which represent the global $_POST array.
protected
_getPostDataCollection() : KeyValueCollection
Return values
KeyValueCollection —_getQueryParameter()
Returns the expected $_GET value by the given key name.
protected
_getQueryParameter(string $keyName) : mixed|null
This method is the object oriented layer for $_GET[$keyName].
Parameters
- $keyName : string
-
Expected key of query parameter.
Return values
mixed|null —Either the expected value or null, of not found.
_getQueryParametersCollection()
Creates and returns a key value collection which represent the global $_GET array.
protected
_getQueryParametersCollection() : KeyValueCollection
Return values
KeyValueCollection —_getRoleById()
Returns the db data for an role by its given id.
protected
_getRoleById(int $roleId) : array<string|int, mixed>
Parameters
- $roleId : int
Return values
array<string|int, mixed> —_getRolesOverviewsListAction()
Returns the necessary information to provide the action for the roles overview listing.
protected
_getRolesOverviewsListAction() : array<string|int, mixed>
Return values
array<string|int, mixed> —_getRolesOverviewsListItems()
Returns the necessary information of all admin roles to generate the overview listing.
protected
_getRolesOverviewsListItems() : array<string|int, mixed>
Return values
array<string|int, mixed> —_getServerData()
Returns the expected $_SERVER value by the given key name.
protected
_getServerData(string $keyName) : string|null
This method is the object oriented layer for $_SERVER[$keyName].
Parameters
- $keyName : string
-
Expected key of server parameter.
Return values
string|null —Either the expected value or null, of not found.
_grantAllPermissionsForRole()
Grants all permission to a given role.
protected
_grantAllPermissionsForRole( $type, $roleId) : mixed
Parameters
Tags
Return values
mixed —_render()
Renders and returns a template file.
protected
_render(string $templateFile, array<string|int, mixed> $contentArray) : string
Parameters
- $templateFile : string
-
Template file to render.
- $contentArray : array<string|int, mixed>
-
Content array which represent the variables of the template.
Return values
string —Rendered template.
_returnHttpResponse()
Creates and returns an AdminLayoutHttpControllerResponse.
protected
_returnHttpResponse([string $title = '' ][, string $template = 'overview.html' ][, array<string|int, mixed> $templateData = [] ][, string $currentSection = '' ]) : AdminLayoutHttpControllerResponse
Parameters
- $title : string = ''
- $template : string = 'overview.html'
- $templateData : array<string|int, mixed> = []
- $currentSection : string = ''
Return values
AdminLayoutHttpControllerResponse —_updateAssignedRolesForAdmin()
Saves the the given role assignments of an admin.
protected
_updateAssignedRolesForAdmin( $adminId, array<string|int, mixed> $assignedRoles) : mixed
Parameters
Return values
mixed —_updatePermissionsForRole()
Updates the given permissions of an admin.
protected
_updatePermissionsForRole( $type, $roleId, array<string|int, mixed> $grantedGroups) : mixed
Parameters
Tags
Return values
mixed —_updateUnknownPermissionsForRole()
Updates the permission for unknown groups of a role by a given value.
protected
_updateUnknownPermissionsForRole( $type, $roleId, $value) : mixed
Parameters
Return values
mixed —_validatePageToken()
Check if the $_POST['pageToken'] or $_GET['pageToken'] variable is provided and if it's valid.
protected
_validatePageToken([string $customExceptionMessage = null ]) : mixed
Example: public function proceed(HttpContextInterface $httpContext) { parent::proceed($httpContext); // proceed http context from parent class if($_SERVER['REQUEST_METHOD'] === 'POST') { $this->_validatePageToken(); // CSRF Protection } }
Parameters
- $customExceptionMessage : string = null
-
(optional) You can specify a custom exception message.
Tags
Return values
mixed —getTemplateFile()
Searches the GXModules directory and admin/html directory for a template file, wich can be useed inside the AdminLayoutHttpControllerResponse object for the template parameter.
protected
getTemplateFile(string $templateFile) : ExistingFile
Parameters
- $templateFile : string
-
The relative path and filename to search for
Tags
Return values
ExistingFile —containing absolute file path to the given template file
isValidJson()
protected
isValidJson(string $string) : bool
Parameters
- $string : string
Return values
bool —isValidRequestMethod()
protected
isValidRequestMethod(string $method) : bool
Parameters
- $method : string
Return values
bool —prepareJsonInput()
protected
prepareJsonInput(string $json) : array<string|int, mixed>
Parameters
- $json : string