LJ::check_priv

LJ::check_priv — Check to see if a user has a certain privilege.

Use

LJ::check_priv(u, priv, arg);

Arguments

  • u. A hashref of a row from the user table, sometimes called a "user object". Although only initially a row from the user table, gets a lot of tacked onto it from various other LJ API functions.

  • priv. Priv name to check for (see priv_list)

  • arg. Optional argument. If defined, function only returns true when $remote has a priv of type $priv also with arg $arg, not just any priv of type $priv, which is the behavior without an $arg. Arg can be "*", for all args.

Info

Usually this is used to check the privs of a $remote user. See LJ::get_remote. As such, a $u argument of undef is okay to pass: 0 will be returned, as an unknown user can't have any rights.

Source:

cgi-bin/LJ/User.pm

Returns:

boolean; true if user has privilege