OpenBroadcaster Documentation
classes / obfuser.php

OBFUser

Class

User class. Manages user authorization, permissions, and settings.

public  &get_instance ( )

Create an instance of OBFUser or return the already created instance.

Returns instance
public  __construct ( )

Create an instance of OBFUser. Make DB, IO, and Load classes available.

public  auth ( id, key )

Figure out if the user is authenticated (i.e. logged in). Loads userdata into $this->userdata. Also sets $this->is_admin to TRUE if the user has access to the admin group.

Parameters
id
key
Returns is_auth
public  auth_appkey ( appkey, requests )

Instead of using the regular authorization, authorize a user using an App Key.

Parameters
appkey
Returns is_auth
public  check_permission ( permission )

Check if the logged in user has a specific permission.

Parameters
permission
Returns has_permission
public  disallow_appkey ( )

Deny access if using an API key.

public  get_group_ids ( )

Get the current user's group IDs, return FALSE if no user is logged in.

Returns group_ids
public  get_setting ( name )

Get a user setting by name, return FALSE if no user is logged in or the setting can't be found.

Parameters
name
Returns setting
public  login ( user, pass )

Logs in a user. Returns key if successful, FALSE otherwise. Loads userdata into $this->userdata.

Parameters
user
pass
Returns key
public  logout ( )

Logs out the current user.

public  param ( param )

Get a parameter from the userdata. Returns FALSE if no user is logged in.

Parameters
param
Returns value
public  password_hash ( pass )

Hash a password.

Parameters
pass
Returns hash
public  password_verify ( pass, hash )

Verify a password against a hash.

Parameters
pass
hash
Returns is_matching
private  random_key ( )

Generate a random key.

Returns key
public  require_authenticated ( )

Function to put on top of controller methods that require authentication. This throws an error and kills the call if no user is logged in.

public  require_permission ( permission )

Require a specific permission. Like require_authenticated(), but for a specific permission, will throw an error and abort the call if the user doesn't have it.

Parameters
permission
public  set_setting ( name, value )

Set a user setting. Returns FALSE if no user is logged in.

Parameters
name
value
Returns status