\BlockRolePermissionBehavior

BlockRolePermission Behavior

ブロックモデルにアソシエーションがあるモデルのビヘイビアです。
ブロックデータの内、ブロック権限にかかわる項目(コンテンツ作成有無など)を処理します。
BlockRolePermissionFormHelperで作成される権限配列を登録します。

配列サンプル

$model->data = array(
    'BlockRolePermission' => array(
        'content_creatable' => array(
            general_user' => array(
                'id' => '999',
                'roles_room_id' => '99',
                'block_key' => 'abcdefg',
                'permission' => 'content_creatable'
                'value' => '0'
            ),
        'content_comment_creatable' => array(
            'editor' => array(
                'id' => '998',
                'roles_room_id' =>'98'
                'block_key' =>  'abcdefg',
                'permission' => 'content_comment_creatable'
                'value' => '1'
            ),
            'general_user' => array(
                'id' => '997',
                'roles_room_id' =>'97'
                'block_key' =>  'abcdefg',
                'permission' => 'content_comment_creatable'
                'value' => '0'
            ),
            'visitor' => array(
                'id' => '996',
                'roles_room_id' =>'96'
                'block_key' =>  'abcdefg',
                'permission' => 'content_comment_creatable'
                'value' => '0'
            ),
        ),
        'content_comment_publishable' => array(
            'editor' => array(
                'id' => '995',
                'roles_room_id' =>'98'
                'block_key' =>  'abcdefg',
                'permission' => 'content_comment_publishable'
                'value' => '0'
            ),
        ),
    ),
)

Summary

Methods
Properties
Constants
beforeValidate()
afterSave()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

beforeValidate()

beforeValidate(\Model  $model, array  $options = array()) : mixed

beforeValidate is called before a model is validated, you can use this callback to add behavior validation rules into a models validate array. Returning false will allow you to make the validation fail.

Parameters

\Model $model

Model using this behavior

array $options

Options passed from Model::save().

Returns

mixed —

False or null will abort the operation. Any other result will continue.

afterSave()

afterSave(\Model  $model, boolean  $created, array  $options = array()) : boolean

afterSave is called after a model is saved.

Parameters

\Model $model

Model using this behavior

boolean $created

True if this save created a new record

array $options

Options passed from Model::save().

Throws

\InternalErrorException

Returns

boolean