Remove temporary permissions after commit
@param $event
770285
public function afterCommit(TransactionEvent $event) {
    if ($event->getPhase() == TransactionEvent::AFTER_COMMIT) {
      // remove temporary permissions
      $permissionManager = $this->getPermissionManager();
      foreach ($this->tempPermissions as $permission) {
        $permissionManager->removeTempPermission($permission);
      }
    }
  }
557110
public function onBeforeDeleteLanguageCommit(BeforeDeleteLanguageCommitEvent $event)
    {
        if ($event->isAborted()) {
            return;
        }

        $this->languageManager = $event->getContentManager();
        $languageRepository = $this->languageManager->getLanguageRepository();

        $this->sourceObjects = $this->setUpSourceObjects();
        if (null === $this->sourceObjects) {
            return;
        }

        if (count($this->sourceObjects) > 0) {
            try {
                $result = true;
                $languageRepository->startTransaction();
                foreach ($this->sourceObjects as $sourceObject) {
                    $result = $this->delete($sourceObject);
                    if (!$result) {
                        break;
                    }
                }

                if (false !== $result) {
                    $languageRepository->commit();
                } else {
                    $languageRepository->rollBack();

                    $event->abort();
                }
            } catch (\Exception $e) {
                $event->abort();
                if (isset($languageRepository) && $languageRepository !== null) {
                    $languageRepository->rollBack();
                }

                throw $e;
            }
        }
    }
1219376
protected function _modifyRulesChecker(Event $event)
    {
        $rulesChecker = $event->subject->viewVars['rulesChecker'];

        foreach ($rulesChecker as $key => $config) {
            if (Hash::get($config, 'extra') !== 'Versions' || $key !== 'version_id') {
                continue;
            }

            unset($rulesChecker[$key]);
        }

        return $rulesChecker;
    }
727557
public function beforeInsert($event)
    {
        foreach ($this->insert as $field) {
            $event->sender->$field = time();
        }
    }
998642
static function removeTemporary()
    {
        $version = 1;
        $temporaryWorkflows = eZWorkflow::fetchList( $version, null, true );

        $db = eZDB::instance();
        $db->begin();
        foreach ( $temporaryWorkflows as $workflow )
        {
            $workflow->removeThis( true );
        }
        eZPersistentObject::removeObject( eZWorkflowEvent::definition(),
                                          array( 'version' => $version ) );
        $db->commit();
    }
724543
public static function setPermissionsChmod(Event $event)
	{
		$http_user = self::getHttpdUser($event);
		foreach (self::getWritableDirs($event) as $path) {
			self::ChmodPermissionsSetter($event, $http_user, $path, 'dir');
		}
		foreach (self::getWritableFiles($event) as $path) {
			self::ChmodPermissionsSetter($event, $http_user, $path, 'file');
		}
	}
723270
public function clearEventHandlers($event = null)
    {
        if (!empty($event)) {
            $this->events[$event] = [];
        } else {
            $this->events = [];
        }
    }
773265
def remove_permission(payload, permission):
    """"""
    payload = copy.deepcopy(payload)

    for entity_type in ['users', 'groups']:
        for perm_type in ['add', 'remove']:
            for perms in payload.get(entity_type, {}).get(perm_type, {}).values():
                if permission in perms:
                    perms.remove(permission)

    for perm_type in ['add', 'remove']:
        perms = payload.get('public', {}).get(perm_type, [])
        if permission in perms:
            perms.remove(permission)

    return payload
935320
public static function process($event)
    {
        // Link Lead with User
        if ($event->account_linking->status === 'linked') {
            $authorization_code = $event->account_linking->authorization_code;
            $user_id = str_replace('user_id:', '', $authorization_code);
            
            return self::linkWithExistingUser($event->sender->id, $user_id);
        } // Unlink, Logout user
        
        return self::unlinkWithExistingUser($event->sender->id);
    }
642813
public function off($event)
    {
        $event = $this->getEventName($event);

        if ($this->hasListener($event)) {
            unset($this->sortedListeners[$event], $this->listeners[$event]);
        }

        unset($event);
    }
946335
public function eventAfterDelete($event)
    {
        if ($this->isLoggable()) {
            Yii::$app->db->createCommand()->insert('{{%admin_ngrest_log}}', [
                'user_id' => $this->getUserId(),
                'timestamp_create' => time(),
                'route' => $this->route,
                'api' => $this->api,
                'is_insert' => false,
                'is_update' => false,
                'is_delete' => true,
                'attributes_json' => $this->toJson($event->sender->getAttributes()),
                'table_name' => $event->sender->tableName(),
                'pk_value' => implode("-", $event->sender->getPrimaryKey(true)),
            ])->execute();
        }
    }
884812
public static function postInstall(Event $event): void
    {
        require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';

        self::clearCompiled();
    }
650524
public function clearGlobalEventHandlers($event = null)
    {
        if (!empty($event)) {
            $this->globalEvents[$event] = [];
        } else {
            $this->globalEvents = [];
        }
    }
154428
function clearEventHandlers($event = null)
	{
		if (!empty($event)) {
			$this->_events[$event] = array();
		}
		else {
			$this->_events = array();
		}
	}
745798
public function checkPermissions(ConfigureMenuEvent $event): void
    {
        if (!$this->permissionResolver->hasAccess('setup', 'administrate')) {
            $menu = $event->getMenu();
            $menu->removeChild(MainMenuBuilder::ITEM_ADMIN);
        }
    }
924971
public function handlePersist(PersistEvent $event)
    {
        /** @var SecurityBehavior $document */
        $document = $event->getDocument();

        if (!$this->supports($document) || !$document->getPermissions()) {
            return;
        }

        $node = $event->getNode();

        foreach ($document->getPermissions() as $roleId => $permission) {
            // TODO use PropertyEncoder, once it is refactored
            $node->setProperty('sec:role-' . $roleId, $this->getAllowedPermissions($permission));
        }
    }
434690
public static function permissionDirs(Event $event)
    {
        $options = self::getOptions($event);
        $appDir = $options['ppi-app-dir'];
        $logsDir = realpath($appDir) . '/logs';
        $cacheDir = realpath($appDir) . '/cache';
        foreach(array($logsDir, $cacheDir) as $dir) {
            if(is_dir($dir) && is_writable($dir)) {
                @chmod($dir, 0777);
            }
        }

    }