Check the correct permission in directory :
/elements
/apps
@return int Correct permissions or not
@throws Server500 Permissions are incorrect
498256
public static function checkPermission():int
    {
        if (!Server::checkIsExecutable(FEnv::get("framework.root")."elements/") ||
            !Server::checkIsReadable(FEnv::get("framework.root")."elements/") ||
            !Server::checkIsWritable(FEnv::get("framework.root")."elements/")) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Core Error : Folder /elements does not have correct permission",
                "solution" => "Must be read, write, executable permission")));
        }

        if (!Server::checkIsExecutable(FEnv::get("framework.root")."apps/") ||
            !Server::checkIsReadable(FEnv::get("framework.root")."apps/") ||
            !Server::checkIsWritable(FEnv::get("framework.root")."apps/")) {
            throw new Server500(new \ArrayObject(array("explain" =>
                "Core Error : Folder /apps does not have correct permission",
                "solution" => "Must be read, write, executable permission")));
        }
        return (1);
    }
6713
public function permissions()
    {
        if (is_array($this->permissions)) {
            return $this->permissions;
        }

        if ($this->permissions) {
            return [ $this->permissions ];
        }

        return [];
    }
1060502
private boolean checkPermission(String permission) {
        int res = ctx.checkCallingOrSelfPermission(permission);
        return (res == PackageManager.PERMISSION_GRANTED);
    }
615835
public function providePermissions()
    {
        $category = _t(__CLASS__ . '.PERMISSION_CATEGORY', 'SilverWare folders');
        
        return [
            'SILVERWARE_FOLDER_CREATE' => [
                'category' => $category,
                'name' => _t('.PERMISSION_CREATE_NAME', 'Create folders'),
                'help' => _t('.PERMISSION_CREATE_HELP', 'Ability to create SilverWare folders.'),
                'sort' => 100
            ],
            'SILVERWARE_FOLDER_EDIT' => [
                'category' => $category,
                'name' => _t('.PERMISSION_EDIT_NAME', 'Edit folders'),
                'help' => _t('.PERMISSION_EDIT_HELP', 'Ability to edit SilverWare folders.'),
                'sort' => 200
            ],
            'SILVERWARE_FOLDER_DELETE' => [
                'category' => $category,
                'name' => _t('.PERMISSION_DELETE_NAME', 'Delete folders'),
                'help' => _t('.PERMISSION_DELETE_HELP', 'Ability to delete SilverWare folders.'),
                'sort' => 300
            ]
        ];
    }
344285
def check_apps_permission(self, apps):
        
        for app in apps:
            if app in self.apps_dict:
                return True

        return False
376350
private static void checkPermission() {
        SecurityManager security = System.getSecurityManager();
        if (security != null)
            security.checkPermission(modifyThreadPermission);
    }
1222238
@Override
	public boolean checkPermission(Permission permission)
	{
		if (permission == null)
			return false;

		boolean authorized = false;
		for (Permission accessPermission : permissions)
		{
			if(accessPermission.isAuthorized(permission))
			{
				authorized = true;
				break;
			}
		}
		
		if(negative)
			return !authorized;
		else
			return authorized;
	}
243034
public function setApplicationPermissions()
    {
        $files = (array) $this->config->getContextually('remote.permissions.files');
        foreach ($files as &$file) {
            $this->modulable->setPermissions($file);
        }

        return true;
    }
1035308
protected function hasPermission()
    {
        $request = $this->request;
        $do = $this->getAction('can');

        return ! $this->forbiddenRoute() && $request->user()->can($do);
    }
1263555
protected function checkFilePermissions()
    {
        foreach ($this->requiredWritableFolders as $folder) {
            $folderPath = FLOW_PATH_ROOT . $folder;
            if (!is_dir($folderPath) && !\Neos\Utility\Files::is_link($folderPath)) {
                try {
                    \Neos\Utility\Files::createDirectoryRecursively($folderPath);
                } catch (\Neos\Flow\Utility\Exception $exception) {
                    return new Error('Unable to create folder "%s". Check your file permissions (did you use flow:core:setfilepermissions?).', 1330363887, [$folderPath]);
                }
            }
            if (!is_writable($folderPath)) {
                return new Error('The folder "%s" is not writable. Check your file permissions (did you use flow:core:setfilepermissions?)', 1330372964, [$folderPath]);
            }
        }

        return null;
    }
525036
public function getPermissions()
    {
        return (!$this->permissions) ? $this->permissions = $this->rolePermissions()->get()->merge($this->userPermissions()->get()) : $this->permissions;
    }
92809
public function getPermissions()
    {
        if (!$this->permissions) {
            $permissions = new Permissions('Job/Permissions');
            if ($this->user) {
                $permissions->grant($this->user, Permissions::PERMISSION_ALL);
            }
            $this->setPermissions($permissions);
        }

        return $this->permissions;
    }
331492
private function setPermissions()
    {
        if (!App::environment('production') || $this->option('force')) {
            $this->comment("Setting write permissions");
            foreach ($this->writableDirectories as $path) {
                $this->process->setCommandLine('chmod -R 0777 ' . base_path($path));
                $this->process->setTimeout(null);
                $this->process->run();

                if (!$this->process->isSuccessful()) {
                    $this->error("Could not set write permissions to " . $path);
                    break;
                }
            }

            $this->comment("Permissions set successfully");

            return $this;
        }else{
            $this->error("Write permissions can not be set in production environment. use --force option if you are really sure you want to proceed!");
        }
    }
205919
protected function checkStoragePermission()
    {
        Session::checkServicePermission(
            Verbs::POST, $this->storageService, trim($this->storageFolder, '/'), Session::getRequestor()
        );
    }
305430
public function check_access() {
        global $CFG;
        $context = empty($this->context) ? context_system::instance() : $this->context;
        foreach($this->req_capability as $cap) {
            if (has_capability($cap, $context)) {
                return true;
            }
        }
        return false;
    }
847244
public function check_permissions() {
        if ($this->recordid) {
            if (data_isowner($this->recordid)) {
                return has_capability('mod/data:exportownentry', context_module::instance($this->cm->id));
            }
            return has_capability('mod/data:exportentry', context_module::instance($this->cm->id));
        }
        if ($this->has_export_config() && !$this->get_export_config('mineonly')) {
            return has_capability('mod/data:exportallentries', context_module::instance($this->cm->id));
        }
        return has_capability('mod/data:exportownentry', context_module::instance($this->cm->id));
    }
683342
public function canView()
    {
        return (Director::isDev() || Director::is_cli() ||
            !$this->config()->get('check_permission') ||
            Permission::check($this->config()->get('check_permission'))
        );
    }