You are here

function fasttoggle_node_status_access in Fasttoggle 7

Same name in this branch
  1. 7 fasttoggle.api.php \fasttoggle_node_status_access()
  2. 7 module/fasttoggle_node/fasttoggle_node.module \fasttoggle_node_status_access()

Access control function.

An access control function should check permissions of the user to modify the object, generally wrapping the check in fasttoggle_deny_access_if() if a TRUE return value should result in access being denied, or fasttoggle_allow_access_if if a TRUE value should result in access being granted.

A single hook may invoke either or both functions, as many times as are needed. The first invocation that allows or denies access will be the effective one.

If the neither of these functions are invoked by a hook with the TRUE value, other hooks will be invoked, providing other modules the opportunity to perform access checks. A TRUE value will cause other hooks to be skipped.

The site and group-wide settings for disabling settings are always also checked.

Parameters

object $obj: The object being checked.

string $type: The type of the object.

string $group: The group to which the setting belongs. NULL if sitewide access is being checked.

string $instance: The instance being checked. NULL if site or groupwide access is being checked.

2 string references to 'fasttoggle_node_status_access'
fasttoggle_node_fasttoggle_available_links in ./fasttoggle.api.php
Get the list of potential links for an object type.
fasttoggle_node_fasttoggle_available_links in module/fasttoggle_node/fasttoggle_node.module
Implements hook_fasttoggle_labels().

File

./fasttoggle.api.php, line 160
Hooks provided by the Fasttoggle module.

Code

function fasttoggle_node_status_access($obj, $type, $group, $instance) {
  fasttoggle_allow_access_if(user_access("override {$obj->type} published option"));
  fasttoggle_deny_access_if(!user_access('moderate posts'));
}