classes / obfuser.php
OBFUser
Class
User class. Manages user authorization, permissions, and settings.
public
&get_instance
(
)
public
&get_instance
(
)
Create an instance of OBFUser or return the already created instance.
instance
public
__construct
(
)
public
__construct
(
)
Create an instance of OBFUser. Make DB, IO, and Load classes available.
public
auth
(
id, key
)
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.
id |
|
key |
is_auth
public
auth_appkey
(
appkey, requests
)
public
auth_appkey
(
appkey, requests
)
Instead of using the regular authorization, authorize a user using an App Key.
appkey |
is_auth
public
check_permission
(
permission
)
public
check_permission
(
permission
)
Check if the logged in user has a specific permission.
permission |
has_permission
public
disallow_appkey
(
)
public
disallow_appkey
(
)
Deny access if using an API key.
public
get_group_ids
(
)
public
get_group_ids
(
)
Get the current user's group IDs, return FALSE if no user is logged in.
group_ids
public
get_setting
(
name
)
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.
name |
setting
public
login
(
user, pass
)
public
login
(
user, pass
)
Logs in a user. Returns key if successful, FALSE otherwise. Loads userdata into $this->userdata.
user |
|
pass |
key
public
logout
(
)
public
logout
(
)
Logs out the current user.
public
param
(
param
)
public
param
(
param
)
Get a parameter from the userdata. Returns FALSE if no user is logged in.
param |
value
public
password_hash
(
pass
)
public
password_hash
(
pass
)
Hash a password.
pass |
hash
public
password_verify
(
pass, hash
)
public
password_verify
(
pass, hash
)
Verify a password against a hash.
pass |
|
hash |
is_matching
private
random_key
(
)
private
random_key
(
)
Generate a random key.
key
public
require_authenticated
(
)
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
)
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.
permission |
public
set_setting
(
name, value
)
public
set_setting
(
name, value
)
Set a user setting. Returns FALSE if no user is logged in.
name |
|
value |
status