1 /**
  2  *  ---------
  3  * |.##> <##.|  Open Smart Card Development Platform (www.openscdp.org)
  4  * |#       #|
  5  * |#       #|  Copyright (c) 1999-2018 CardContact Software & System Consulting
  6  * |'##> <##'|  Andreas Schwier, 32429 Minden, Germany (www.cardcontact.de)
  7  *  --------- 
  8  *
  9  *  This file is part of OpenSCDP.
 10  *
 11  *  OpenSCDP is free software; you can redistribute it and/or modify
 12  *  it under the terms of the GNU General Public License version 2 as
 13  *  published by the Free Software Foundation.
 14  *
 15  *  OpenSCDP is distributed in the hope that it will be useful,
 16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18  *  GNU General Public License for more details.
 19  *
 20  *  You should have received a copy of the GNU General Public License
 21  *  along with OpenSCDP; if not, write to the Free Software
 22  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 23  *
 24  * @fileoverview AccessController base class
 25  */
 26 
 27  
 28 /**
 29  * Create an default controller granting read but denying write access 
 30  * @Class Class implementing a default access controller
 31  * @constructor
 32  */
 33 function AccessController() {
 34 	this.name = "AccessController";
 35 }
 36 
 37 exports.AccessController = AccessController;
 38 
 39 
 40 
 41 /**
 42  * Check if read access to file system node is allowed
 43  *
 44  * @param {APDU} apdu the APDU used to access the object
 45  * @param {FSNode} node the file system object
 46  * @type boolean
 47  * @return true if access is allowed
 48  */
 49 AccessController.prototype.checkFileReadAccess = function(ci, apdu, node) {
 50 	return true;
 51 }
 52 
 53 
 54 
 55 /**
 56  * Check if write access to file system node is allowed
 57  *
 58  * @param {APDU} apdu the APDU used to access the object
 59  * @param {FSNode} node the file system object
 60  * @type boolean
 61  * @return true if access is allowed
 62  */
 63 AccessController.prototype.checkFileWriteAccess = function(ci, apdu, node) {
 64 	return false;
 65 }
 66 
 67 
 68 
 69 /**
 70  * Check if command is allowed
 71  *
 72  * @param {APDU} apdu the APDU to check
 73  * @type boolean
 74  * @return true if access is allowed
 75  */
 76 AccessController.prototype.checkCommandAccess = function(ci, apdu) {
 77 	return true;
 78 }
 79 
 80 
 81 
 82 AccessController.prototype.toString = function() {
 83 	return this.name;
 84 }
 85