yii1-module/yii1-access

A module for Pluggable Applications that manages user accesses


Keywords
manager, module, user, access, yii, pluggable, plug, anastaszor
License
MIT

Documentation

yii1-access

A module for Pluggable Applications that manages user accesses.

This library requires the yiipluggable base because it inherits its interfaces and the crisu83/yiistrap library because it uses its easiness to write bootstrap3+ components to html.

Installation

The installation of this library is made via composer. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		"oomphinc/composer-installers-extender" : ">=1",
		"yii1-module/yii1-access": ">=2"
	},
	"extra" : {
		"installer-types" : [
			"yii1-module",
		],
		"installer-paths" : {
			"modules/{$name}" : [
				"type:yii1-module"
			]
		}
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

The oomphinc custom installer lets composer install into the app/modules directory the modules that otherwise would go into the app/vendor directory. This is made to allow the YiiPlug application to correctly autoload the modules when it sees it.

API

This module follow the requirements of IPluggableAccessModule interface and provides the methods to retrieve accesses from web users.

This checking is done via the method : boolean checkAccess(IPluggableModule $module, IPluggableWebUser $user, string $role, boolean $askForPrivilegeElevation, string[] $params);

This method will check if the user $user has the role $role for the module $module with given parameters $params. If privilege elevation is needed ($askForPrivilegeElevation == true) and the user do not have the needed privilege, the check action will be halted and the user will be redirected to the privilege elevation action. If the privilege elevation is not needed, then this method will return whether the user has the needed privilege.

License

MIT. See license file.