Initialization permissions

@return void
559301
protected function initPermissions()
    {
        if ($this->app->runningInConsole()) {
            return;
        }

        Permission::get()->map(function(Permission $permission) {
            Gate::define($permission->name, function ($user) use ($permission) {
                return $user->hasPermission($permission);
            });
        });        
    }
137444
public function init()
    {
        // authorization check
        if (!$this->_authorize()) {
            \OxidEsales\Eshop\Core\Registry::getUtils()->redirect('index.php?cl=login', true, 302);
            exit;
        }

        $oLang = \OxidEsales\Eshop\Core\Registry::getLang();

        // language handling
        $this->_iEditLang = $oLang->getEditLanguage();
        $oLang->setBaseLanguage();

        parent::init();

        $this->_aViewData['malladmin'] = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('malladmin');
    }
371978
public function init() {

		parent::init();

		// Permission
		$this->crudPermission = NotifyGlobal::PERM_NOTIFY_ADMIN;

		// Config
		$this->type		= NotifyGlobal::TYPE_ANNOUNCEMENT;
		$this->apixBase	= 'notify/template';

		// Sidebar
		$this->sidebar = [ 'parent' => 'sidebar-announcement', 'child' => 'template' ];

		// Return Url
		$this->returnUrl = Url::previous( 'templates' );
		$this->returnUrl = isset( $this->returnUrl ) ? $this->returnUrl : Url::toRoute( [ '/notify/announcement/template/all' ], true );

		// Breadcrumbs
		$this->breadcrumbs = [
			'base' => [
				[ 'label' => 'Home', 'url' => Url::toRoute( '/dashboard' ) ]
			],
			'all' => [ [ 'label' => 'Announcement Templates' ] ],
			'create' => [ [ 'label' => 'Announcement Templates', 'url' => $this->returnUrl ], [ 'label' => 'Add' ] ],
			'update' => [ [ 'label' => 'Announcement Templates', 'url' => $this->returnUrl ], [ 'label' => 'Update' ] ],
			'delete' => [ [ 'label' => 'Announcement Templates', 'url' => $this->returnUrl ], [ 'label' => 'Delete' ] ]
		];
	}
128152
def _setup_default_permissions(instance):
    """"""
    from abilian.services import get_service

    security = get_service("security")
    for permission, roles in instance.__default_permissions__:
        if permission == "create":
            # use str for comparison instead of `abilian.services.security.CREATE`
            # symbol to avoid imports that quickly become circular.
            #
            # FIXME: put roles and permissions in a separate, isolated module.
            continue
        for role in roles:
            security.add_permission(permission, role, obj=instance)
517272
public function init() {

		parent::init();

		// Permissions
		$this->crudPermission = NotifyGlobal::PERM_NOTIFY_ADMIN;

		// Services
		$this->modelService = Yii::$app->factory->get( 'activityService' );
	}
681703
public function init()
	{
		parent::init();
		if($this->authFile===null)
			$this->authFile=Yii::getPathOfAlias('application.data.auth').'.php';
		$this->load();
	}
33937
protected function initAdminDirectory()
    {
        $this->directory = config('admin.directory');

        if (is_dir($this->directory)) {
            $this->line("<error>{$this->directory} directory already exists !</error> ");

            return;
        }

        $this->makeDir('/');
        $this->line('<info>Admin directory was created:</info> '.str_replace(base_path(), '', $this->directory));

        $this->makeDir('Controllers');

        $this->createHomeController();
        $this->createExampleController();
        //$this->createAuthController();
        //$this->createAdministratorController();

        //$this->createMenuFile();
        $this->createBootstrapFile();
        $this->createRoutesFile();

        //$this->copyLanguageFiles();
    }
1360258
public function init() {
        //If available load the config from the security file, else create a new array
        if ($this->securityFile) {
            if (!$this->loadSecurityConfiguration()) {
                $this->config = array();
            }
        } else {
            $this->config = array();
        }
        //Set ready to true
        $this->ready = true;
    }
399181
public function Permission() {
      if ($this->DeliveryMethod() == DELIVERY_METHOD_XHTML) {
         header("HTTP/1.0 401", TRUE, 401);
         $this->Render();
      } else
         $this->RenderException(PermissionException());
   }
448022
protected function init() {		
	    if(Apc::isAvailable()) {
		    $driver = new Apc();
		} else {
			if (!is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) {
				// We may not have permission - especially during setup, before we instruct
				// the user to "chmod 777 /data"
				@mkdir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache');
			}
			if (is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) {
			    $driver = new FileSystem(array('path' => WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache'));
			} else {
				// No cache available, let's just use a basic one :-(
				$driver = new Ephemeral();
			}
		}		

		$this->cache = new \Stash\Pool($driver);		
		$this->is_init = true;
	}
542380
public function init() {

		parent::init();

		// Permission
		$this->crudPermission = FormsGlobal::PERM_FORM_ADMIN;

		// Services
		$this->modelService	= Yii::$app->factory->get( 'formService' );
	}
191292
public void setPermissions(Permissions permissions) {
        if (this.permissions == permissions) {
            return;
        }

        this.removeChildObject("permissions");
        this.permissions = permissions;
        this.addChildObject("permissions", permissions);
    }
583943
public function init()
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();
        $user = oxNew(\OxidEsales\Eshop\Application\Model\User::class);
        $user->loadAdminUser();

        if (($user->oxuser__oxrights->value == 'malladmin' || $user->oxuser__oxrights->value == $config->getShopId())) {
            $this->isInitialized = true;
            $this->userId = $user->getId();
        } else {
            //user does not have sufficient rights for shop
            throw new Exception(self::ERROR_USER_NO_RIGHTS);
        }

        return $this->isInitialized;
    }
114078
protected function _init() {
		parent::_init();
		$this->_rules += [
			'allowAll' => [
				'rule' => function() {
					return true;
				}
			],
			'denyAll' => [
				'rule' => function() {
					return false;
				}
			],
			'allowAnyUser' => [
				'message' => 'You must be logged in.',
				'rule' => function($user) {
					return $user ? true : false;
				}
			],
			'allowIp' => [
				'message' => 'Your IP is not allowed to access this area.',
				'rule' => function($user, $request, $options) {
					$options += ['ip' => false];
					if (is_string($options['ip']) && strpos($options['ip'], '/') === 0) {
						return (boolean) preg_match($options['ip'], $request->env('REMOTE_ADDR'));
					}
					if (is_array($options['ip'])) {
						return in_array($request->env('REMOTE_ADDR'), $options['ip']);
					}
					return $request->env('REMOTE_ADDR') === $options['ip'];
				}
			]
		];
	}
585058
public function init() {

		parent::init();

		// Permission
		$this->crudPermission = CoreGlobal::PERM_USER;

		// Config
		$this->layout = CoreGlobalWeb::LAYOUT_PUBLIC;

		// Services
		$this->modelService = Yii::$app->factory->get( 'postService' );

		$this->templateService = Yii::$app->factory->get( 'templateService' );

		$this->categoryService	= Yii::$app->factory->get( 'categoryService' );
		$this->tagService		= Yii::$app->factory->get( 'tagService' );
	}
396670
public function init() {

		parent::init();

		// Views
		$this->setViewPath( '@cmsgears/module-community/admin/views/group/post' );

		// Permission
		$this->crudPermission = CmnGlobal::PERM_GROUP_ADMIN;

		// Config
		$this->type	= CoreGlobal::TYPE_DEFAULT;

		$this->templateType = CmnGlobal::TYPE_GROUP_POST;

		// Services
		$this->modelService = Yii::$app->factory->get( 'groupPostService' );

		$this->parentService = Yii::$app->factory->get( 'groupService' );

		$this->templateService = Yii::$app->factory->get( 'templateService' );
	}
1181852
private function initialize()
    {
        if ($this->initialized) {
            return;
        }

        if ($this->session->isStarted() && $this->session->get('stack') !== null) {
            $paths = $this->session->get('stack');
            $this->files = $this->hydrateList($paths);
        } else {
            $paths = $this->users->getCurrentUser()['stack'];
            $this->files = $this->hydrateList($paths);
            $this->session->set('stack', $this->persistableList());
        }

        $this->initialized = true;
    }