Book Image

Yii Project Blueprints

By : Charles R. Portwood ll
Book Image

Yii Project Blueprints

By: Charles R. Portwood ll

Overview of this book

Table of Contents (15 chapters)
Yii Project Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Managing users


Before we can begin working on issues, we first need to make sure that users can be both created and managed from within our application. In Chapter 3, Scheduled Reminders, we used a command-line tool to do this. In this chapter, we will create a complete user management tool from a web interface to supplement that tool.

Roles and authentication

Before we get into managing our users, let's take a look at how authentication and roles are handled within our application. Within the UserController and IssueController provided with the skeleton application is a more complex accessRules() method that has a new attribute added to it. Let's take a look at this method within UserController:

public function accessRules()
{
   return array(
      array('allow',
         'actions' => array('search', 'view'),
         'users'=>array('@'),
         'expression' => 'Yii::app()->user->role>=2'
      ),
      array('allow',
         'actions' => array('index', 'save', 'delete...