[Frontaccounting-cvs_updates] /hg/p/frontaccounting/mercurial: Additional access control relat...
Brought to you by:
frontaccounting,
itronics
From: FrontAccounting <fro...@us...> - 2015-02-28 17:05:26
|
details: http://frontaccounting.hg.sourceforge.net:8000/hgroot/frontaccounting/frontaccounting/hg/p/frontaccounting/mercurial/rev/048324b8d432 changeset: 3524:048324b8d432 user: Janusz Dobrowolski <ja...@fr...> date: Fri Feb 20 15:26:50 2015 +0100 description: Additional access control related ui helpers added: check_edit_access, access_post, access_num diffstat: includes/access_levels.inc | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diffs (43 lines): diff -r c0a7279e71f7 -r 048324b8d432 includes/access_levels.inc --- a/includes/access_levels.inc Fri Feb 20 11:02:50 2015 +0100 +++ b/includes/access_levels.inc Fri Feb 20 15:26:50 2015 +0100 @@ -314,3 +314,39 @@ return array($security_areas, $security_sections); } */ + +function check_edit_access($name) +{ + global $input_security; + + $access = @$input_security[$name]; + + if (!$access) + $access = @$input_security['']; // default access level + + if (!$access) + return true; // if constraint is not defined edit access is allowed + + return user_check_access($access); +} +/* + Returns POST value or null if edit access to $name control is forbidden. +*/ +function access_post($name, $dflt=null) +{ + if (!check_edit_access($name)) + return $dflt; + else + return get_post($name, $dflt); +} + +/* + Returns numeric input value or null if edit access to $name control is forbidden. +*/ +function access_num($name, $dflt=null) +{ + if (!check_edit_access($name)) + return $dflt; + else + return input_num($name, $dflt); +} |