Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'authmanager'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. First of all thank you for an invaluable resource - its helped me alot! I am having a bit of a problem setting up the database for the authManager. I used the setup script to set up three databases: Auth Assignment, AuthItem and AuthItemChild - but when I run the setup script it appears to stop adding to the database when it gets to the task bit! Am very much a newbie, so any help as to where my code is going wrong would be greatly appreciated! Vicki public function actionSetup() { $auth=Yii::app()->authManager; // Create Operations $auth->createOperation('createPage'); $auth->createOperation('updatePage'); $auth->createOperation('deletePage'); $auth->createOperation('createFile'); $auth->createOperation('updateFile'); $auth->createOperation('deleteFile'); $auth->createOperation('createComment'); $auth->createOperation('updateComment'); $auth->createOperation('deleteComment'); $auth->createOperation('updateUser'); $auth->createOperation('deleteUser'); // Create Tasks // Update oe delete own user only $task=$auth->createTask('updateOwnUser', 'Allows a user to update her record','return $params["id"]==Yii::app()->user->id;'); $task=addChild('updateUser'); $task=addChild('deleteUser'); // Create your own content $task=$auth->createTask('createContent', 'Allows users to create content on the site'); $task=addChild('createPage'); $task=addChild('createFile'); $task=addChild('createComment'); // Edit your own content only $task=$auth->createTask('updateOwnContent', 'Allows a user to update pages or files that she owns','return $params["ownerId"]==$params["userId"];'); $task=addChild('updatePage'); $task=addChild('deletePage'); $task=addChild('updateFile'); $task=addChild('deleteFile'); $task=addChild('updateComment'); //Create MAKESHIFTER Role $role=$auth->createRole('makeshifter'); //add a task to a role $role=addChild('updateOwnUser'); //add an operation to a role $role=addChild('createComment'); // Create TUTOR Role $role=$auth->createRole('tutor'); //add a role to a role $role=addChild('makeshifter'); //add a task to a role $role=addChild('createContent'); $role=addChild('updateOwnContent'); // Create ADMIN Role $role=$auth->createRole('admin'); //add a role to a role $role=addChild('tutor'); //add a task to a role $role=addChild('updatePage'); $role=addChild('deletePage'); $role=addChild('updateFile'); $role=addChild('deleteFile'); $role=addChild('updateComment'); $role=addChild('deleteComment'); $role=addChild('updateUser'); $role=addChild('deleteUser'); // assign roles(1) to users(2) static default yii //$auth->assign('public','demo'); //save rules $auth->save(); } }
  2. How does the code below (p. 268) work? Is it definitely correct? Can someone walk me through this? In actionSetup (A): Why is updateUser a child of updateOwnUser? Doesn't that mean anyone who can update his/her OWN user info can also update anyone else's? In the controller (: Why is checkAccess (array('id' => $id)) used on updateUser instead of updateOwnUser? Does updateUser even use the ID parameter? Please help - thanks... Quite confused! Code A: # protected/controllers/SiteController.php::actionSetup() $auth = Yii::app()->authManager; // Create operations. $task = $auth->createTask('updateOwnUser', 'Allows a user to update her record', 'return $params["id"] == Yii::app()->user->id;'); $task->addChild('updateUser'); Code B: # protected/controllers/UserController.php public actionUpdate($id) { $model=$this->loadModel($id); if (!Yii::app()->user->checkAccess('updateUser', array('id' => $id))) { throw new CHttpException(403, 'You are not allowed to do this.'); } // Code for doing this. }
×
×
  • Create New...