You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					56 lines
				
				1.4 KiB
			
		
		
			
		
	
	
					56 lines
				
				1.4 KiB
			| 
											13 years ago
										 | <?php
 | ||
|  | /**
 | ||
|  |  * @link http://www.yiiframework.com/
 | ||
|  |  * @copyright Copyright (c) 2008 Yii Software LLC
 | ||
|  |  * @license http://www.yiiframework.com/license/
 | ||
|  |  */
 | ||
|  | 
 | ||
| 
											13 years ago
										 | namespace yii\rbac;
 | ||
| 
											13 years ago
										 | 
 | ||
|  | use Yii;
 | ||
|  | use yii\base\Object;
 | ||
|  | 
 | ||
|  | /**
 | ||
| 
											13 years ago
										 |  * Assignment represents an assignment of a role to a user.
 | ||
|  |  * It includes additional assignment information such as [[bizRule]] and [[data]].
 | ||
|  |  * Do not create a Assignment instance using the 'new' operator.
 | ||
| 
											13 years ago
										 |  * Instead, call [[Manager::assign()]].
 | ||
| 
											13 years ago
										 |  *
 | ||
| 
											13 years ago
										 |  * @author Qiang Xue <qiang.xue@gmail.com>
 | ||
|  |  * @author Alexander Kochetov <creocoder@gmail.com>
 | ||
|  |  * @since 2.0
 | ||
|  |  */
 | ||
| 
											13 years ago
										 | class Assignment extends Object
 | ||
| 
											13 years ago
										 | {
 | ||
|  | 	/**
 | ||
| 
											13 years ago
										 | 	 * @var Manager the auth manager of this item
 | ||
| 
											13 years ago
										 | 	 */
 | ||
| 
											13 years ago
										 | 	public $manager;
 | ||
| 
											13 years ago
										 | 	/**
 | ||
| 
											13 years ago
										 | 	 * @var string the business rule associated with this assignment
 | ||
| 
											13 years ago
										 | 	 */
 | ||
| 
											13 years ago
										 | 	public $bizRule;
 | ||
| 
											13 years ago
										 | 	/**
 | ||
| 
											13 years ago
										 | 	 * @var mixed additional data for this assignment
 | ||
| 
											13 years ago
										 | 	 */
 | ||
| 
											13 years ago
										 | 	public $data;
 | ||
| 
											13 years ago
										 | 	/**
 | ||
| 
											13 years ago
										 | 	 * @var mixed user ID (see [[User::id]]). Do not modify this property after it is populated.
 | ||
|  | 	 * To modify the user ID of an assignment, you must remove the assignment and create a new one.
 | ||
| 
											13 years ago
										 | 	 */
 | ||
| 
											13 years ago
										 | 	public $userId;
 | ||
| 
											13 years ago
										 | 	/**
 | ||
| 
											13 years ago
										 | 	 * @return string the authorization item name. Do not modify this property after it is populated.
 | ||
|  | 	 * To modify the item name of an assignment, you must remove the assignment and create a new one.
 | ||
| 
											13 years ago
										 | 	 */
 | ||
| 
											13 years ago
										 | 	public $itemName;
 | ||
| 
											13 years ago
										 | 
 | ||
|  | 	/**
 | ||
|  | 	 * Saves the changes to an authorization assignment.
 | ||
|  | 	 */
 | ||
|  | 	public function save()
 | ||
|  | 	{
 | ||
| 
											13 years ago
										 | 		$this->manager->saveAssignment($this);
 | ||
| 
											13 years ago
										 | 	}
 | ||
| 
											13 years ago
										 | }
 |