API / Minn\Auth / Can

Can final class

Minn\Auth\Can · public/minn/src/Minn/Auth/Can.php · 51 lines

Whether a user may do something, as WordPress decides it: the capability mapped to the primitive ones it needs (map_meta_cap, a meta key's auth filters included), the user's capabilities as user_has_cap leaves them, and every primitive one granted. "exist" is always granted and "do_not_allow" never.

Public

staticcurrent(mixed $capability, mixed ...$args): mixed#

Whether the request's user may (current_user_can).

staticuser(mixed $user, mixed $capability, mixed ...$args): mixed#

Whether a user, by record or id, may (user_can), as the record's has_cap answers; anyone not a user is asked as nobody.

staticcheck(object $user, mixed $capability, mixed ...$args): bool#

Whether the user record has a capability (WP_User::has_cap): a number is the old user level; the primitive ones it maps to must each be set in the user's capabilities as user_has_cap leaves them.

staticmap(mixed $capability, mixed $userId, mixed ...$args): mixed#

The primitive capabilities a capability needs for a user (map_meta_cap): a meta key's own when it is a meta capability, else the engine's map, the first argument read as the object's id; then map_meta_cap.