{"id":20963868,"url":"https://github.com/codemix/hybridauthmanager","last_synced_at":"2025-03-13T07:25:46.192Z","repository":{"id":56955506,"uuid":"11898459","full_name":"codemix/hybridauthmanager","owner":"codemix","description":"An AuthManager for Yii that stores the hierarchy in a flat PHP file and the assignments in DB","archived":false,"fork":false,"pushed_at":"2013-08-22T19:12:32.000Z","size":80,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-20T01:34:47.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codemix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-05T13:09:31.000Z","updated_at":"2018-02-28T21:56:29.000Z","dependencies_parsed_at":"2022-08-21T04:40:25.501Z","dependency_job_id":null,"html_url":"https://github.com/codemix/hybridauthmanager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fhybridauthmanager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fhybridauthmanager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fhybridauthmanager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codemix%2Fhybridauthmanager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codemix","download_url":"https://codeload.github.com/codemix/hybridauthmanager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243360343,"owners_count":20278365,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T02:48:41.088Z","updated_at":"2025-03-13T07:25:46.153Z","avatar_url":"https://github.com/codemix.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"HybridAuthManager\n=================\n\nAn AuthManager for Yii that stores the hierarchy in a flat PHP file and the assignmens in DB.\n\nThis class is a combination of CDbAuthManager and CPhpAuthManager:\n\n  * The authorization hierarchy is stored in a flat PHP file\n  * Authorization assignments are stored in the database\n\nThis is useful if the authorization hierarchy is almost static and not very complex.\n\nYou can manage the authorization hierarchy in data/auth.php. To not loose the comments there,\nyou should avoid to call any method to create auth items or add child items - even though it's supported.\n\n## Installation\n\nWe recommend to install the extension with [composer](http://getcomposer.org/). Add this to\nthe `require` section of your `composer.json`:\n\n    'codemix/hybridautmanager' : 'dev-master'\n\n\u003e Note: There's no stable version yet.\n\nIf you haven't yet, you should also add an alias to composer's vendor directory.\n\n```php\n$vendor = realpath(__DIR__.'/../vendor');\nreturn array(\n    'alias' =\u003e array(\n        'vendor' =\u003e realpath(__DIR__.'/../vendor'), // Fix this path\n    ),\n    ...\n```\n\n## Configuration\n\nAdd this configuration to your `main.php`:\n\n```php\n'components' =\u003e array(\n    'authManager' =\u003e array(\n        'class' =\u003e 'vendor.codemix.hybridautmanager.HybridAuthManager',\n    ),\n    ...\n),\n```\n\nJust as with [`CPhpAuthManager`](http://www.yiiframework.com/doc/api/1.1/CPhpAuthManager) you'll\nneed to supply a file with auth rules. By default this is in `data/auth.php`. But here you only\nhave to supply the auth hierarchy:\n\n```php\nreturn array(\n    // Admin == Root (Full permissions).\n    'Admin' =\u003e array(\n        'type'          =\u003e CAuthItem::TYPE_ROLE,\n        'description'   =\u003e 'Administrator',\n        'children'      =\u003e array(\n            'manageUser',\n            'managePosts',\n        ),\n    ),\n    'manageUser' =\u003e array(\n        'type' =\u003e CAuthItem::TYPE_TASK,\n        'children' =\u003e array(\n            'createUser',\n            'updateUser',\n            'deleteUser',\n            'readUser',\n        ),\n    ),\n\n    'createUser'    =\u003e array('type' =\u003e CAuthItem::TYPE_OPERATION),\n    'updateUser'    =\u003e array('type' =\u003e CAuthItem::TYPE_OPERATION),\n    'deleteUser'    =\u003e array('type' =\u003e CAuthItem::TYPE_OPERATION),\n    'readUser'      =\u003e array('type' =\u003e CAuthItem::TYPE_OPERATION),\n\n);\n```\n\nThe content of this file will be cached unless you set `cacheID` to `null`.\n\nThe actual Role assignments will be saved in a DB table `auth_assignments` by default.\nYou can change this name with the `assignmentTable` property of the `authManager` component.\n\n## Caching\n\nThe component can cache the RBAC hierarchy and auth assignments. You can configure\nthe cache component ID on `cacheID`.\n\n### Caching hierarchy\n\nBy default the hierarchy file content is cache `3600` seconds. You can configure this\nthrough `hierarchyCachingDuration`.\n\n### Caching auth assigments\n\nYou can set the number of seconds to cache auth assignments in `assignmentCachingDuration`.\nThe assignments will be cached per user to avoid DB calls on each request. By default this\nis set to `0` which means, that assignments will only be cached throughout the current\nrequests, i.e. on consecutive calls of `checkAccess()`.\n\nSet this property to `false` to completely disable caching.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fhybridauthmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodemix%2Fhybridauthmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodemix%2Fhybridauthmanager/lists"}