I need some help with CheckAccess function.
I'm reading book Agile Web Application Development with Yii1.1 and PHP5, and came to page 212. On this page I've to added a "Create user" menu item.
I login with the user that is associated with the project (in Db table project_user_role) like a member, and members has operateion called 'createUser'.
The problem is that I can't see the menu item which should be generated by the following code:
if (Yii::app()->user->checkAccess('createUser', array('project' => $model))) {
$this->menu[] = array('label' => 'Add User To Project', 'url' => array('adduser', 'id' => $model->id));
}
Thanks
Also with AuthAssignment there are two more tables and even having them is not full deal. You got to have set RBAC :).
Please SeeRole-Based Access Control
Related
I want to make client login and registration; and Admin login in laravel 5. In my database I gave a column named "roles" with enum 'admin'and 'client'.
Now what should I make in Routes.php and other files if necessary to redirect client to client page and admin to admin area after login successful.
Thankyou.
No need to reinvent the wheel, try bican/roles. I've been using it for a few weeks and its great!
I would look at something like Sentry.
Available here:
https://cartalyst.com/manual/sentry/2.1
The syntax is clean, and aligns well to laravel
Sentry::createGroup(array(
'name' => 'Subscribers',
'permissions' => array(
'admin' => 1,
'users' => 1,
),
));
Hey In authentication of cakephp3.0 I am facing some problem Hey how can i create an authentication based on patient table and patient controller like url/patient/login I have controller and model and form ready but when I go to login page it always search for query from usertable by default when I am trying to add this code in Patientcontroller :
$this->Auth->config('authenticate', [
AuthComponent::ALL => ['userModel' => 'Members'],
'Basic',
'Form']);
I am getting this error :
Error: Class 'App\Controller\AuthComponent' not found
File D:\xampp\htdocs\hwapp\src\Controller\PatientController.php
Line: 34``
Please read this section of the documentation: http://book.cakephp.org/3.0/en/controllers/components/authentication.html#configuring-authentication-handlers
It explains how to use other table for handling login and how to tell the AuthComponent to use anther controller and action to handle the logic.
I am createing a cms based on zend framework 2 . I have som modules , let's say News module.
It has two controllers one for backend and one for front page :
News Module :
-- AdminController
-- IndexController
My question is How can I list all AdminControllers in my admin module ?
I think it can be achieved by event manager but I don't know how
Thanks in advance
Your Admin module does this:
check a config key (i.e. super_cms)
check if a subkey exists (i.e. controllers)
foreach entries in said subkey, list them on your webpage
Your News module does this:
//module.config.php
return [
'super_cms' => [
'controllers' => [
'NewsModule\Controller\AdminController' => [
'label' => 'News',
'permission' => 'Admin',
'route' => 'news/admin'
]
]
]
];
Now with this setup, you could do a foreach on the controllers and create a navigation that has all your controllers listed that you need. You could specify dedicated label options, you could assign permission keys that are required for access or you could assign a dedicated route to call.
This is all up to you tho. But without configuration, nothing works. There are "magic" ways, yes, but they would all require you to recursively scan lots and lots of directories which you don't want! Seriously, you don't!
Is there a way I can access my project under Sandbox? I'm able to use the lookup method, find in order to fetch all the features from a project under the Yahoo! subscription, but how would I be able to do this for projects under Sandbox?
In your PHP code have you used Rally sandbox server URL?
https://sandbox.rallydev.com/
Here is a WebServices URL specific to Sandbox:
https://sandbox.rallydev.com/slm/doc/webservice/
I was able to figure it out. In the query to find specific features, I had to include the query parameter "workspace" to the sandbox reference which is (for 1.43) : "https://rally1.rallydev.com/slm/webservice/1.43/workspace/7189290105.js". I included the reference of the project as well which directly fetched all the features for my project. In addition, if you seek to only fetch features from your specific project and not from the ones on top of it, you have to include the "pageScopeUp" field into the query. You have to set this field to false:
$queryParams = array(
'query' => "",
'fetch' => 'true',
'pagesize' => 100,
'start' => 1,
'workspace' => "https://rally1.rallydev.com/slm/webservice/1.43/workspace/7189290105.js",
'project' => "whatever the project reference is",
'projectScopeUp' => false
);
$results = Connection::rally()->findWithQueryParameters('feature',
$queryParams);
With GII I have created a list of records. I use the admin view so they are in a table view. On top of the table it is the search with a status for the records. When the status dropdown is changed I submit the form and the table gets searched. I want the default view of the admin to show only the active records so I want to create a link in the menu to this:
medium/admin/?Medium[status]=active
The actual link of course is
medium/admin/?Medium%5Bstatus%5D=active
I have tried to do it with:
CHtml::link('Mediums', array("medium/admin", array('Medium[status]' => 'active')))
CHtml::link('Mediums', array("medium/admin", array('Medium%5Bstatus%5D' => 'active')))
CHtml::link('Mediums', array("medium/admin", array('Medium' => array('status' => 'active'))))
But all of the links are incorrect so the default view of the table is with all the records shown.
What is the correct way to create such a link?
Thank you.
http://www.yiiframework.com/doc/api/1.1/CHtml#link-detail and http://www.yiiframework.com/wiki/48/ will be usefull for you.
CHtml::link(CHtml::encode('Mediums'),array("medium/admin", "status"=>"active"));
Then ensure that in your controller you have something like this:
public function actionAdmin($status)
Now you ca use 'status' in your action.