<?php

$user = uss::$global['user'];

if( $user ) {
	
	// permission;
	
	$permit = ( roles::user( $user['id'] )::hasPermission('view-cpanel') );
	
	if( $permit ) {
		
		
		// authenticate admin page;

		dashboard::config( 'auth', $permit );


		// if admin authentication is successful;

		if( dashboard::config('auth') ) uss::console( "_ajax2", core::url( ADMIN_MOD_DIR . "/pages/ajax" ) );
		
		
	} else {
		
		uss::view(function() {
			require ADMIN_MOD_DIR . '/views/restricted.php';
		});
		
		exit;
		
	};
	
};