glFusion Wiki

Site Tools


glfusion:development:api:sec

SEC_ Functions

These functions provide access to glFusion Security library. These functions are defined in private/system/lib-security.php and are included by glFusion.

This is the security library for glFusion. This is used to implement glFusion's *nix-style security system.

Programming notes: For items you need security on you need the following for each record in your database:

owner_id mediumint(8)
group_id mediumint(8)
perm_owner tinyint(1) unsigned
perm_group tinyint(1) unsigned
perm_members tinyint(1) unsigned
perm_anon tinyint(1) unsigned

For display one function can handle most needs:

function SEC_hasAccess($owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon)

A call to this function will allow you to determine if the current user should see the item.

For the admin screen several functions will make life easier:

function SEC_getPermissionsHTML($perm_owner,$perm_group,$perm_members,$perm_anon)

This function displays the permissions widget with arrays for each permission

function SEC_getPermissionValues($perm_owner,$perm_group,$perm_members,$perm_anon)

This function takes the permissions from the previous function and converts them into an integer for saving back to the database.

Function Description
SEC_addUserToGroup() Add user to a group
SEC_authenticate() Attempt to login a user.
SEC_buildAccessSql() Common function used to build group access SQL
SEC_checkToken() Check a security token.
SEC_checkTokenGeneral() NEW
SEC_checkUserStatus() Return the current user status for a user.
SEC_collectRemoteAuthenticationModules() Return available modules for Remote Authentication
SEC_createToken() Generate a security token.
SEC_createTokenGeneral() NEW
SEC_encryptPassword() Encrypt password
SEC_getFeatureGroup() Return the group to a given feature.
SEC_getGroupDropdown() Create a group dropdown
SEC_getPermissionHTML() Shows security control for an object
SEC_getPermissionValue() Converts permission array into numeric value
SEC_getPermissionValues() Converts permissions to numeric values
SEC_getUserGroups() Returns the groups a user belongs to
SEC_getUserPermissions() Gets everything a user has permissions to within the system
SEC_groupIsRemoteUserAndHaveAccess() Checks to see if a user has admin access to the “Remote Users” group
SEC_hasAccess() Checks if current user has access to the given object
SEC_hasRights() Checks if current user has rights to a feature
SEC_hasTopicAccess() Checks to see if current user has access to a topic
SEC_inGroup() Determines if user belongs to specified group
SEC_isModerator() Determines if current user is a moderator of any kind
SEC_remoteAuthentication() Check to see if we can authenticate this user with a remote server
SEC_removeFeatureFromDB() Remove a feature from the database entirely.
SEC_setCookie() Set a cookie using the HttpOnly flag
SEC_setDefaultPermissions() Set default permissions for an object
glfusion/development/api/sec.txt · Last modified: 2017/04/12 21:13 (external edit)

Page Tools