if($data->get_value('selected') == '0')
	{
		$sql = 'delete from login_role_link where lro_id ='.$_GET['roleid'].' and dep_id ='.$data->get_id().';';
	}else{

		$sql = 'insert into login_role_link(lro_id,dep_id) values('.$_GET['roleid'].','.$data->get_id().');';
	}


	<?php
	require_once '../../autoload.php';
	
	// RightsCheck ("VIEW_LOGINROLE");
	
	$lro_id	 		= -1;
	$dep_id	 		= -1;
	$selected		= 0;
	
	if ( isset ( $_REQUEST['lro_id'] )		)	$lro_id		= $_REQUEST['lro_id'];
	if ( isset ( $_REQUEST['dep_id'] )		)	$dep_id		= $_REQUEST['dep_id'];
	if ( isset ( $_REQUEST['selected'] )	)	$selected	= $_REQUEST['selected'];
					
	$conn = get_dbconnection();
	
	$response = -1;
	
	if ( $conn )
	{
		$sql = '';

		if ( $selected == 0 )
			$sql = 'delete from login_role_link where lro_id ='.$lro_id.' and dep_id ='.$dep_id.';';
		else
			$sql = 'insert into login_role_link(lro_id,dep_id) values('.$lro_id.','.$dep_id.');';

		error_log ( "sql : " .$sql);
		
		$result = pg_query ( $conn, $sql );
		
		if ( $result )
		{
			$response = $dep_id;
		}
	}
	
	header ('Content-type: text/xml' );
	
	echo $response;
?>