<?php

	// Check nonce
	PHPCUS_PARAM::CUS_REQUIRES_NONCE();
	
	// Dismiss Session
	PHPVC_SESSION::VAR_STOP();

	// Check Array Input
	PHPCUS_PARAM::CUS_DOES_NOT_SUPPORT_ARRAY();
	
	// Check already authenticated
	PHPCUS_PARAM::CUS_REQUIRES_AUTHENTICATION();

	// Check access rights
	// PHPCUS_PARAM::CUS_HAS_PERMISSION(PHPCUS_SYSTEM::AUTHORITY_VIEW_EDIT, 'account_level');
	
	if
	(
			PHPRC_HTTP_PARAM::REF_ISSET_IN_ARRAY
			(
					[
							'PARAM_LEVEL_ID'
					], True
			)
	)
	{
		Try
		{
			// Read params
			// ------------------------------------------------------------------
			$PARAM_LEVEL_ID = PHPCUS_PARAM::CUS_READ_BIGINT('PARAM_LEVEL_ID');
			// ------------------------------------------------------------------
				
			// Execute Stored Procedure
			$DATA_SET = PHPCUS_Account_Access_Rights::CUS_ACCESS_RIGHTS_PREPARE($PARAM_LEVEL_ID);
						
			// Return JSON response
			PHPCUS_PARAM::CUS_JSON_SUCCESS($DATA_SET);	
		}
		Catch(Exception $ERR)
		{
			PHPCUS_PARAM::CUS_JSON_ERROR($ERR);
		}
	}
	else
	{
		PHPCUS_PARAM::CUS_JSON_ERROR('Missing parameters');
	}

?>