FOSSology  4.4.0
Open Source License Compliance by Open Source Software
common-perms.php File Reference

Library of common functions for permissions and groups. More...

Go to the source code of this file.

Functions

 GetUploadsFromFolder ($folder_pk)
 
 GetUploadsFromFolder_recurse ($folder_pk, &$uploads)
 
 AddUserToGroupArray ($GroupRow, &$GroupArray)
 Check if User is already in the $GroupArray. More...
 
 GetGroupUsers ($user_pk, $group_pk, &$GroupArray)
 Get all the users users of this group. More...
 
 GetUsersGroups ($user_pk='')
 Find all the groups a user belongs to. More...
 
 GetGroupArray ($user_pk)
 Get array of groups that this user has admin access to @depricated use UserDao::getAdminGroupMap() More...
 
 DeleteGroup ($group_pk)
 Delete a group. More...
 

Detailed Description

Library of common functions for permissions and groups.

Definition in file common-perms.php.

Function Documentation

◆ AddUserToGroupArray()

AddUserToGroupArray (   $GroupRow,
$GroupArray 
)

Check if User is already in the $GroupArray.

If not, add them. If they are, update their record with the highest permission granted to them.

Parameters
array$GroupRowGroup row from DB
[in,out]array&$GroupArrayGroup array where user is to be added
Returns
$GroupArray is updated.

Definition at line 76 of file common-perms.php.

◆ DeleteGroup()

DeleteGroup (   $group_pk)

Delete a group.

Parameters
int$group_pkGroup to be deleted
Returns
NULL on success, string on failure.

Definition at line 213 of file common-perms.php.

◆ GetGroupArray()

GetGroupArray (   $user_pk)

Get array of groups that this user has admin access to @depricated use UserDao::getAdminGroupMap()

Parameters
int$user_pk
Returns
Array in the format {group_pk=>group_name, group_pk=>group_name, ...} Array may be empty.

Definition at line 182 of file common-perms.php.

◆ GetGroupUsers()

GetGroupUsers (   $user_pk,
  $group_pk,
$GroupArray 
)

Get all the users users of this group.

Parameters
int$user_pkOptional, if specified limit to single user
int$group_pkGroup id to look into
[in,out]array&$GroupArray
Returns
Array of groups the and the user's permission (group_perm) in each group
  • [user_pk]
  • [group_pk]
  • [group_name]
  • [group_perm]

Definition at line 114 of file common-perms.php.

◆ GetUploadsFromFolder()

GetUploadsFromFolder (   $folder_pk)

Get all the uploads inside a given folder

Parameters
int$folder_pk
Returns
Array of upload_pks for all the uploads in this folder (and subfolders).

Definition at line 22 of file common-perms.php.

◆ GetUploadsFromFolder_recurse()

GetUploadsFromFolder_recurse (   $folder_pk,
$uploads 
)

Get the upload ids of all uploads inside given folder.

Note
This is recursive!
Parameters
int$folder_pk
[in,out]array$uploadsArray of upload_pk's.
Returns
Array of upload_pks for all the uploads in this folder (and subfolders).
See also
GetUploadsFromFolder()

Definition at line 43 of file common-perms.php.

◆ GetUsersGroups()

GetUsersGroups (   $user_pk = '')

Find all the groups a user belongs to.

Parameters
int$user_pkOptional, defaults to current user
Returns
Array of groups each group is itself an array with the following elements
  • [user_pk]
  • [group_pk]
  • [group_name]
  • [group_perm]

Definition at line 150 of file common-perms.php.