Permissions

Allows to centrally manage the framework file permissions

Please note: directories require a +x ("search permission") to allow listing of its contents

In permissions.json:
- user permissions are relative paths from the user's home directory (relative paths do not start with a /)
- entries for paths to directories should have a trailing /
- $USER can be used in owner and group fields (a call to getUserPermissions('hlrally') will replace '$USER' with 'hlrally')
- chown/chgrp are called with -R

Class Methods

The following methods can be invoked on instances of this class.

loadPermissions(unknown strPath)

Allows to load the permissions definition json
The path to the permissions json can be overriden by first calling this method with a custom path example: \Framework\System\FileSystem\Permissions::loadPermissions('/home/hades/src/synergy8/permissions.json');

determineFindExclusions(array arrPermissions)

Determines paths that should be excluded when executing the find command for each permission definition
Example: if there is a permission definition for public_html/index.php, another defined permission for public_html/ should not be applied to it, and excludes public_html/index.php

getUserPermissions(string strUser)

Retrieves defined user permissions for a specific user

getSystemPermissions()

Retrieves defined system permissions

applyPermission(mixed strPath, mixed arrPermission)

Applies a permission definition to a specific path

fixUserPermissions(mixed strUser)

Fixes a specific user permissions by applying all the user permissions defined in JSON

fixSystemPermissions()

Fixes system permissions by applying all the system permissions defined in JSON

__call(mixed strName, array arrArguments)

Magic function to trap calls to undefined functions and throw an exception rather than
a fatal error.

__callStatic(mixed strName, array arrArguments)

Magic function to trap static calls to undefined functions and throw an exception rather
than a fatal error.

classGetFolder()

Returns the folder where the class exists

__set_state(mixed arrValues)

classGetFolderResources()

Returns the folder where the class's resources exist

classGetSrcFile()

Returns the folder where the class exists

classGetSrcHash()

Returns the folder where the class exists

classGetReflection()

Returns the reflection data for the current class

classGetReflectionAnnotation(string strField)

Returns a specific class annotation for the current class