|
|
|
News id
|
43
|
Headline
|
Dataface record checkPermission() function
|
Content
|
The dataface record class has a function called the checkPermission($permission) where the parameter is a name of a permission specified in the permissions.ini file.<br /><br />Different users will have different permissions and so if the user who is currently logged in does not have this permission they won't be access the block of code that requires this permission. For example:<br /><br /><blockquote><br />if ( $record->checkPermission('view_stats') ){<br />//Do something here<br />}<br /></blockquote><br /><br />The the user who is currently logged in must have the view_stats permission. So assume like the user who is logged in has the role "REP" So if you go the permissions.ini file in the main application folder, then open it up you should be able to find the role "REP" which has permissions like this:<br /><br /><blockquote><br />[REP extends READ ONLY]<br /> ;; This role is applied to company representatives with respect to a company<br /> ;; profile.<br /> add new related record=1<br /> view_company_profile=1<br /> export_xml=0<br /> view xml=0<br /> rss=0<br /> export_csv=0<br /> view_stats=1<br /></blockquote><br /><br />Notice how the last line is view_stats = 1 meaning they have the permission view_stats. And so they will be able to access the block of code.
|
Image
|
(Empty)
|
Date posted
|
Wed Jun 4 00:31:00 2008
|
Posted by
|
noreply@blogger.com (Fong Chun Chan)
|
Status
|
Approved
|
Categories
|
Blog
|
Source id
|
Fong's Blog
|
Source url
|
http://fongxataface.blogspot.com/2008/06/dataface-record-checkpermission.html
|
|
|