»

LJ::check_priv

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

Use

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

Arguments

  • dbarg. Deprecated; a master database handle ($dbh) or a master/slave set of database handles ($dbs).

  • 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

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/ljlib.pl

Returns:

boolean; true if user has privilege