mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 09:04:28 +00:00
- Moved all the logic from controller PCRM to PCRMLib
- Extended functionality to others HTTP methods - Added checking permissions if the requested resource is a library (permissions are automatically handled by models) using PermissionLib - Extended PermissionLib
This commit is contained in:
@@ -34,32 +34,54 @@ require_once(FCPATH.'include/benutzerberechtigung.class.php');
|
||||
|
||||
class PermissionLib
|
||||
{
|
||||
const SELECT_RIGHT = "s";
|
||||
const UPDATE_RIGHT = "u";
|
||||
const INSERT_RIGHT = "i";
|
||||
const DELETE_RIGHT = "d";
|
||||
|
||||
public $bb;
|
||||
|
||||
/**
|
||||
* Auth Username, Password over FH-Complete
|
||||
*
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
function __construct()
|
||||
{
|
||||
$this->CI =& get_instance();
|
||||
$this->CI->load->helper('fhcauth');
|
||||
// Loads CI instance
|
||||
$this->ci =& get_instance();
|
||||
|
||||
// Loads the library to manage the rights system
|
||||
$this->ci->load->library("FHC_DB_ACL");
|
||||
|
||||
// Loads the array of resources
|
||||
$this->ci->fhc_db_acl->acl = $this->ci->config->item('fhc_acl');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool <b>true</b> if a user has the right to access to the specified
|
||||
* resource with a specified permission type, <b>false</b> otherwise
|
||||
*/
|
||||
public function hasPermission($sourceName, $permissionType)
|
||||
{
|
||||
// If the resource exists
|
||||
if (isset($this->ci->fhc_db_acl->acl[$sourceName]))
|
||||
{
|
||||
// Checks permission
|
||||
return $this->ci->fhc_db_acl->isBerechtigt($this->ci->fhc_db_acl->acl[$sourceName], $permissionType);
|
||||
}
|
||||
// if the resource does not exist, do not lose useful clock cycles
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isBerechtigt($berechtigung_kurzbz, $art = null, $oe_kurzbz = null, $kostenstelle_id = null)
|
||||
{
|
||||
$this->bb->getBerechtigungen(getAuthUID());
|
||||
return $this->bb->isBerechtigt($berechtigung_kurzbz, $oe_kurzbz, $art, $kostenstelle_id);
|
||||
}
|
||||
|
||||
function getPermissions($uid)
|
||||
{
|
||||
}
|
||||
|
||||
function isEntitled($berechtigung_kurzbz, $oe_kurzbz=null, $art=null, $kostenstelle_id=null)
|
||||
{
|
||||
}
|
||||
function getPermissions($uid) {}
|
||||
|
||||
function isEntitled($berechtigung_kurzbz, $oe_kurzbz=null, $art=null, $kostenstelle_id=null) {}
|
||||
}
|
||||
Reference in New Issue
Block a user