Exposed and Hidden Fields

Often you don't want to shared some information with the user. The user should for example be able to see a list of all users, but the password field values should never be transmitted (not even the hashes). In some cases it's also important that the user doesn't even know that a column exists.

You can simple archive this by setting either the exposedFields or excludedFields in your BanchaRemoteableBehavior model configuration.

If you define the exposedFields config, only theses fields will visible to the user. If you define a array of excludedFields, theses fields will be hidden from the list of all fields.

This filter will be applied both to the list of fields a Sencha Touch/Ext JS model has and to the data, which is transfered to the user.

Example

<?php
class User extends AppModel {
	/**
	 * Bancha behaviour with hidden password field
	 */
	public $actsAs = array('Bancha.BanchaRemotable' => array(
		'excludedFields' => array('password')
	);

	//...
}

Comments

Add a comment