The Hubzilla
 All Classes Namespaces Files Functions Variables Pages
security.php File Reference

Some security related functions. More...

Functions

 authenticate_success ($user_record, $channel=null, $login_initial=false, $interactive=false, $return=false, $update_lastlog=false)
 
 atoken_login ($atoken)
 
 atoken_xchan ($atoken)
 
 atoken_delete ($atoken_id)
 
 atoken_create_xchan ($xchan)
 In order for atoken logins to create content (such as posts) they need a stored xchan. we'll create one on the first atoken_login; it can't really ever go away but perhaps. More...
 
 atoken_abook ($uid, $xchan_hash)
 
 pseudo_abook ($xchan)
 
 change_channel ($change_channel)
 Change to another channel with current logged-in account. More...
 
 permissions_sql ($owner_id, $remote_observer=null, $table= '')
 Creates an additional SQL where statement to check permissions. More...
 
 item_permissions_sql ($owner_id, $remote_observer=null)
 Creates an addiontal SQL where statement to check permissions for an item. More...
 
 scopes_sql ($uid, $observer)
 
 public_permissions_sql ($observer_hash)
 
 get_form_security_token ($typename= '')
 
 check_form_security_token ($typename= '', $formname= 'form_security_token')
 
 check_form_security_std_err_msg ()
 
 check_form_security_token_redirectOnErr ($err_redirect, $typename= '', $formname= 'form_security_token')
 
 check_form_security_token_ForbiddenOnErr ($typename= '', $formname= 'form_security_token')
 
 init_groups_visitor ($contact_id)
 
 stream_perms_api_uids ($perms=NULL, $limit=0, $rand=0)
 
 stream_perms_xchans ($perms=NULL)
 

Detailed Description

Some security related functions.

Function Documentation

atoken_abook (   $uid,
  $xchan_hash 
)

Referenced by get_all_perms(), and perm_is_allowed().

atoken_create_xchan (   $xchan)

In order for atoken logins to create content (such as posts) they need a stored xchan. we'll create one on the first atoken_login; it can't really ever go away but perhaps.

Fixme:
we should set xchan_deleted if it's expired or removed
Parameters
array$xchan
Returns
void|boolean

Referenced by account_verify_password().

atoken_delete (   $atoken_id)
atoken_login (   $atoken)

Referenced by zat_init().

atoken_xchan (   $atoken)
Parameters
array$atoken
Returns
array|null

Referenced by account_verify_password(), atoken_abook(), Zotlabs\Module\Lockview\get(), Zotlabs\Module\Acl\init(), and zat_init().

authenticate_success (   $user_record,
  $channel = null,
  $login_initial = false,
  $interactive = false,
  $return = false,
  $update_lastlog = false 
)
Parameters
int$user_recordThe account_id
array$channel
bool$login_initialdefault false
bool$interactivedefault false
bool$return
bool$update_lastlog

Referenced by account_approve(), api_login(), Zotlabs\Module\Cdav\init(), Zotlabs\Module\Dav\init(), ZotOAuth1\loginUser(), and Zotlabs\Module\Register\post().

change_channel (   $change_channel)

Change to another channel with current logged-in account.

Parameters
int$change_channelThe channel_id of the channel you want to change to
Returns
bool|array false or channel record of the new channel

Referenced by api_login(), api_user(), authenticate_success(), Zotlabs\Module\Manage\get(), Zotlabs\Module\Rpost\get(), Zotlabs\Module\Import\import_account(), Zotlabs\Module\Magic\init(), Zotlabs\Module\Cdav\init(), Zotlabs\Module\Dav\init(), owt_init(), Zotlabs\Module\Register\post(), Zotlabs\Module\New_channel\post(), and Zotlabs\Zot\Auth\Verify().

check_form_security_std_err_msg ( )
check_form_security_token (   $typename = '',
  $formname = 'form_security_token' 
)
check_form_security_token_ForbiddenOnErr (   $typename = '',
  $formname = 'form_security_token' 
)
init_groups_visitor (   $contact_id)
item_permissions_sql (   $owner_id,
  $remote_observer = null 
)

Creates an addiontal SQL where statement to check permissions for an item.

Parameters
int$owner_id
bool$remote_observer(optional) use current observer if unset
Returns
string additional SQL where statement

Construct permissions

default permissions - anonymous user

Profile owner - everything is visible

Authenticated visitor. Unless pre-verified, check that the contact belongs to this $owner_id and load the groups the visitor belongs to. If pre-verified, the caller is expected to have already done this and passed the groups into this function.

Referenced by article_tagadelic(), articlecategories_widget(), card_tagadelic(), cardcategories_widget(), categories_widget(), channel_apps(), Zotlabs\Lib\NativeWiki\exists_by_name(), Zotlabs\Module\Pubstream\get(), Zotlabs\Module\Block\get(), Zotlabs\Module\Articles\get(), Zotlabs\Module\Cards\get(), Zotlabs\Module\Editwebpage\get(), Zotlabs\Module\Webpages\get(), Zotlabs\Module\Rpost\get(), Zotlabs\Module\Hq\get(), Zotlabs\Module\Channel\get(), Zotlabs\Module\Photos\get(), Zotlabs\Lib\NativeWiki\get_permissions(), get_webpage_elements(), Zotlabs\Lib\NativeWiki\get_wiki(), Zotlabs\Module\Share\init(), Zotlabs\Module\Page\init(), items_fetch(), Zotlabs\Lib\NativeWiki\listwikis(), Zotlabs\Lib\NativeWikiPage\load_page(), Zotlabs\Lib\NativeWikiPage\load_page_history(), Zotlabs\Module\Oep\oep_articles_reply(), Zotlabs\Module\Oep\oep_cards_reply(), Zotlabs\Module\Oep\oep_display_reply(), Zotlabs\Module\Oep\oep_mid_reply(), Zotlabs\Lib\NativeWikiPage\page_list(), pdl_selector(), tagadelic(), Zotlabs\Widget\Activity\widget(), Zotlabs\Widget\Forums\widget(), Zotlabs\Widget\Random_block\widget(), Zotlabs\Widget\Item\widget(), and zot_feed().

permissions_sql (   $owner_id,
  $remote_observer = null,
  $table = '' 
)

Creates an additional SQL where statement to check permissions.

Parameters
int$owner_id
bool$remote_observer(optional) use current observer if unset
$table(optional)
Returns
string additional SQL where statement

Construct permissions

default permissions - anonymous user

Profile owner - everything is visible

Authenticated visitor. Unless pre-verified, check that the contact belongs to this $owner_id and load the groups the visitor belongs to. If pre-verified, the caller is expected to have already done this and passed the groups into this function.

Referenced by attach_by_hash(), attach_by_hash_nodata(), attach_can_view_folder(), attach_count_files(), attach_list_files(), attach_mkdir(), Zotlabs\Module\Embedphotos\embedphotos_widget_album(), Zotlabs\Lib\Chatroom\enter(), Zotlabs\Module\Cal\get(), Zotlabs\Module\Chatsvc\get(), Zotlabs\Module\Chat\get(), Zotlabs\Module\Thing\get(), Zotlabs\Module\Events\get(), Zotlabs\Module\Photos\get(), Zotlabs\Module\Photo\init(), Zotlabs\Lib\Chatroom\list_count(), menu_fetch(), Zotlabs\Lib\Chatroom\message(), Zotlabs\Module\Oep\oep_album_reply(), Zotlabs\Module\Oep\oep_photo_reply(), Zotlabs\Module\Oep\oep_phototop_reply(), photos_album_exists(), photos_albums_list(), photos_list_photos(), Zotlabs\Module\Chatsvc\post(), Zotlabs\Lib\Chatroom\roomlist(), Zotlabs\Widget\Portfolio\widget(), Zotlabs\Widget\Album\widget(), and z_readdir().

pseudo_abook (   $xchan)

Referenced by get_all_perms(), and perm_is_allowed().

public_permissions_sql (   $observer_hash)
Parameters
string$observer_hash
Returns
string additional SQL where statement

Referenced by Zotlabs\Module\Display\get(), and Zotlabs\Module\Search\get().

scopes_sql (   $uid,
  $observer 
)

Remote visitors also need to be checked against the public_scope parameter if item_private is set. This function checks the various permutations of that field for any which apply to this observer.

Referenced by item_permissions_sql().

stream_perms_api_uids (   $perms = NULL,
  $limit = 0,
  $rand = 0 
)
stream_perms_xchans (   $perms = NULL)