Documentation

GetPermission

int
CForm::GetPermission(
 int form_id,
 array groups = false,
 string from_db = ""
)

The method returns the [link=90282#form]web form access permission[/link]:

  • 1deny - form and its results cannot be accessed;
  • 10form fill - visitor is only allowed to fill and save a form;
  • 15edit own results - visitor is allowed to view, sort, filter a list of his or her results; view, print, edit and delete his or her result. Visitor can also change the visibility state of the result;
  • 20view all results - visitor can view all active results;
  • 25edit all results and view form settings - visitor can view and edit all results; view the form settings (this requires the access to the administrative section);
  • 30full access - includes the above permissions and allows to edit settings of the form.

Not-static method.

Method parameters

Parameter Description
form_id eb form ID.
groups Array of user group IDs. Access permission must be defined for this user groups.

Optional parameter. False by default (current user groups).
from_db If set to "Y", access permission is determined from the database rather than from the Web from module settings. Optional parameter.

See Also

  • [link=90282#form]Web Form access permissions[/link]
  • [link=90387]CFormStatus::GetPermissions[/link]
  • [link=90386]CFormStatus::GetPermissionList[/link]
  • [link=90373]CFormResult::GetPermissions[/link]

Examples of use

<?
$FORM_ID = 4;
// get access permissions of the current user 
$permission = CForm::GetPermission($FORM_ID);
if ($permission==10) echo "You have the access permission to fill in the web form";
?>


© «Bitrix24», 2001-2024
Up