PHP 클래스 Habari\User

상속: extends QueryRecord, implements habari\FormStorage, implements IsContent
파일 보기 프로젝트 열기: habari/system 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$url_args

공개 메소드들

메소드 설명
__construct ( array $paramarray = [] ) Constructor for the User class
__get ( string $name ) : mixed Capture requests for the info object so that it can be initialized properly when the constructor is bypassed (see PDO::FETCH_CLASS pecularities). Passes all other requests to parent.
add_to_group ( integer | string | UserGroup $group ) : null function add_to_group
anonymous ( ) : object Build and return the anonymous user
authenticate ( string $who, string $pw ) : User | boolean Check a user's credentials to see if they are legit -- calls all auth plugins BEFORE checking local database.
can ( string $token, string $access = 'any' ) : boolean Determine if a user has a specific token permission
can_any ( array $token_access = [] ) : boolean Determine if a user has any of a set of tokens
cannot ( string $token ) : boolean Determine if a user has been denied access to a specific token
commenter ( ) : Array Returns an array of information about the commenter If this is a logged-in user, then return details from their user profile.
content_type ( ) : array Returns the content type of the object instance
count_posts ( $status = false ) : integer Returns the number of posts written by this user
create ( $paramarray ) : User Creates a new user object and saves it to the database
default_fields ( ) : array Get default fields for this record.
delete ( ) Delete a user account
deny ( $tokens ) Deny permissions to one or more tokens to this user
field_load ( string $key ) : mixed Loads form values from an object
field_save ( string $key, mixed $value ) Stores a form value into the object
forget ( boolean $redirect = true ) Delete the user id from the session
get ( mixed $who ) : object Fetch a user from the database by name, ID, or email address.
get_by_email ( string $email ) : User Select a user from the database by its email address
get_by_id ( integer $id ) : User Select a user from the database by its id
get_by_name ( string $username ) : User Select a user from the database by its username
get_id ( mixed $user ) : integer Return the id of a user
get_url_args ( ) : array Returns a set of properties used by URL::get to create URLs
grant ( $tokens, $access = 'full' ) Assign permissions to one or more new tokens to this user
identify ( ) : User Check for the existence of a cookie, and return a user object of the user, if successful
in_group ( integer | string $group ) : boolean function in_group Whether or not this user is is in the specified group
insert ( ) Save a new user to the users table
remember ( ) Save the user id into the session
remove_from_group ( integer | string | UserGroup $group ) : null function remove_from_group removes this user from a group
revoke ( $tokens ) Remove permissions to one or more tokens from a user
update ( ) Updates an existing user in the users table

비공개 메소드들

메소드 설명
get_info ( ) : UserInfo function get_info Gets the info object for this user, which contains data from the userinfo table related to this user.
list_groups ( $refresh = false ) : Array Returns an array of groups to which this user belongs

메소드 상세

__construct() 공개 메소드

Constructor for the User class
public __construct ( array $paramarray = [] )
$paramarray array an associative array of initial User fields

__get() 공개 메소드

Capture requests for the info object so that it can be initialized properly when the constructor is bypassed (see PDO::FETCH_CLASS pecularities). Passes all other requests to parent.
public __get ( string $name ) : mixed
$name string requested field name
리턴 mixed the requested field value

add_to_group() 공개 메소드

function add_to_group
public add_to_group ( integer | string | UserGroup $group ) : null
$group integer | string | UserGroup A group ID, name, or UserGroup instance
리턴 null

anonymous() 공개 정적인 메소드

Build and return the anonymous user
public static anonymous ( ) : object
리턴 object user object

authenticate() 공개 정적인 메소드

Check a user's credentials to see if they are legit -- calls all auth plugins BEFORE checking local database.
public static authenticate ( string $who, string $pw ) : User | boolean
$who string A username
$pw string A password
리턴 User | boolean a User object, or false

can() 공개 메소드

Determine if a user has a specific token permission
public can ( string $token, string $access = 'any' ) : boolean
$token string The name of the token for which to check permission
$access string The type of access to check for (read, write, full, etc.)
리턴 boolean True if this user has the requested access, false if not

can_any() 공개 메소드

Determine if a user has any of a set of tokens
public can_any ( array $token_access = [] ) : boolean
$token_access array An array of tokens and the permissions to check for each of them.
리턴 boolean True if this user has the requested access, false if not

cannot() 공개 메소드

Determine if a user has been denied access to a specific token
public cannot ( string $token ) : boolean
$token string The name of the token to detect
리턴 boolean True if this user has been denied access to the requested token, false if not

commenter() 공개 정적인 메소드

If this is a returning commenter, then return details from their cookie otherwise return empty strings.
public static commenter ( ) : Array
리턴 Array an array of name, email and URL

content_type() 공개 메소드

Returns the content type of the object instance
public content_type ( ) : array
리턴 array An array of content types that this object represents, starting with the most specific

count_posts() 공개 메소드

Returns the number of posts written by this user
public count_posts ( $status = false ) : integer
리턴 integer The number of posts written by this user

create() 공개 정적인 메소드

Creates a new user object and saves it to the database
public static create ( $paramarray ) : User
리턴 User the User object that was created

default_fields() 공개 정적인 메소드

Get default fields for this record.
public static default_fields ( ) : array
리턴 array an array of the fields used in the User table

delete() 공개 메소드

Delete a user account
public delete ( )

deny() 공개 메소드

Deny permissions to one or more tokens to this user
public deny ( $tokens )

field_load() 공개 메소드

Loads form values from an object
public field_load ( string $key ) : mixed
$key string The name of a form component that will be loaded
리턴 mixed The stored value returned

field_save() 공개 메소드

Stores a form value into the object
public field_save ( string $key, mixed $value )
$key string The name of a form component that will be stored
$value mixed The value of the form component to store

forget() 공개 메소드

Delete the user id from the session
public forget ( boolean $redirect = true )
$redirect boolean Redirect the user to base_url after destroying session?

get() 공개 정적인 메소드

This is a wrapper function that will invoke the appropriate get_by_* method.
public static get ( mixed $who ) : object
$who mixed user ID, username, or e-mail address
리턴 object User object, or false

get_by_email() 공개 정적인 메소드

Select a user from the database by its email address
public static get_by_email ( string $email ) : User
$email string The email address of a user
리턴 User The User object of the specified user

get_by_id() 공개 정적인 메소드

Select a user from the database by its id
public static get_by_id ( integer $id ) : User
$id integer The id of a user
리턴 User The User object of the specified user

get_by_name() 공개 정적인 메소드

Select a user from the database by its username
public static get_by_name ( string $username ) : User
$username string The name of a user
리턴 User The User object of the specified user

get_id() 공개 정적인 메소드

Return the id of a user
public static get_id ( mixed $user ) : integer
$user mixed The id, name, or email address of a user
리턴 integer The id of the specified user or false if that user doesn't exist

get_url_args() 공개 메소드

Returns a set of properties used by URL::get to create URLs
public get_url_args ( ) : array
리턴 array Properties of this post used to build a URL

grant() 공개 메소드

Assign permissions to one or more new tokens to this user
public grant ( $tokens, $access = 'full' )

identify() 공개 정적인 메소드

Check for the existence of a cookie, and return a user object of the user, if successful
public static identify ( ) : User
리턴 User user object, or false if no valid cookie exists

in_group() 공개 메소드

function in_group Whether or not this user is is in the specified group
public in_group ( integer | string $group ) : boolean
$group integer | string a group ID or name
리턴 boolean Whether or not this user is in the specified group

insert() 공개 메소드

Save a new user to the users table
public insert ( )

remember() 공개 메소드

Save the user id into the session
public remember ( )

remove_from_group() 공개 메소드

function remove_from_group removes this user from a group
public remove_from_group ( integer | string | UserGroup $group ) : null
$group integer | string | UserGroup A group ID, name, or UserGroup instance
리턴 null

revoke() 공개 메소드

Remove permissions to one or more tokens from a user
public revoke ( $tokens )

update() 공개 메소드

Updates an existing user in the users table
public update ( )

프로퍼티 상세

$url_args 보호되어 있는 프로퍼티

protected $url_args