Name

global.ContentAccessEPService

Description

No description available

Script

var ContentAccessEPService = Class.create();
ContentAccessEPService.prototype = {
  /**
  * @tableName, required - the table name of the record on which requested access pattern is being evaluated
  * @current, required - the current object on which requested access pattern is being evaluated
  */
  initialize: function(tableName,current) {
  	this.tableName = tableName;
  	this.current = current;
  },

  /**
  * @params, optional - additional parameters required to evalute the access
  */
  canRead: function(params) {
  	return this._runPattern("canRead", params);
  },


  /**
  * @params, optional - additional parameters required to evalute the access
  */
  canWrite: function(params) {
  	return this._runPattern("canWrite", params);
  },

  /**
  * @params, optional - additional parameters required to evalute the access
  */
  canCreate: function(params) {
  	return this._runPattern("canCreate", params);
  },

  /**
  * @params, optional - additional parameters required to evalute the access
  */
  canDelete: function(params) {
  	return this._runPattern("canDelete", params);
  },
  
  
  //Allows us to run the can* check on multiple extension points.
  _runPattern: function(pattern, params) {
  	if(gs.nil(pattern))
  		return false;

  	var ep = new GlideScriptedExtensionPoint().getExtensions(global.CSMRelationshipConstants.CONTENT_ACCESS_EXTENSION_POINT);
  	for (var e = 0, l = ep.length; e < l; e++) {
  		ep[e].initialize(this.tableName, this.current);
  		if (!ep[e].canProcess(this.tableName)){
  			continue;
  		}

  		if(ep[e][pattern](params))
  			return true;
  	}

  	return false;
  },

  type: 'ContentAccessEPService'
};

Sys ID

b12bb9c977c73010d3ef07dc7d5a996d

Offical Documentation

Official Docs: