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.
		
		
		
		
			
				
					40 lines
				
				842 B
			
		
		
			
		
	
	
					40 lines
				
				842 B
			| 
								 
											7 years ago
										 
									 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Created by Error202
							 | 
						||
| 
								 | 
							
								 * Date: 04.09.2018
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace console\controllers;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use core\services\PermissionManager;
							 | 
						||
| 
								 | 
							
								use yii\console\Controller;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Permissions management from console
							 | 
						||
| 
								 | 
							
								 * Class PermissionController
							 | 
						||
| 
								 | 
							
								 * @package console\controllers
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								class PermissionController extends Controller
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @var PermissionManager Permissions management service
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    private $_service;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    public function __construct(string $id, $module, PermissionManager $service, array $config = [])
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        parent::__construct($id, $module, $config);
							 | 
						||
| 
								 | 
							
								        $this->_service = $service;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * Create permission
							 | 
						||
| 
								 | 
							
								     * @param $name
							 | 
						||
| 
								 | 
							
								     * @param null $description
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function actionAdd($name, $description = null) : void
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $this->_service->create($name, $description);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |