public function ActionRevokeNodePermissions::execute in Content Access 8
Executes the plugin.
Overrides RulesActionBase::execute
File
- src/
Plugin/ RulesAction/ ActionRevokeNodePermissions.php, line 64
Class
- ActionRevokeNodePermissions
- Provides a 'Revoke access by role' action.
Namespace
Drupal\content_access\Plugin\RulesActionCode
public function execute() {
$node = $this
->getContextValue('node');
$permissions = $this
->getContextValue('permissions');
if (!empty($node
->id()) && $this
->checkSetting($node)) {
// Transform the value to the content-access format.
$settings = $this
->transformRulesValue($permissions);
$ca_settings = [];
foreach (_content_access_get_operations() as $op => $label) {
$settings += [
$op => [],
];
$ca_settings[$op] = array_diff(content_access_per_node_setting($op, $node), $settings[$op]);
}
content_access_save_per_node_settings($node, $ca_settings);
$this
->aquireGrants($node);
}
}