I’m encrypting some fileds on my database.
I’ve created an EncryptBehavior and I load it on desired Tables passing desired columns to it.
It is working fine but I’d like to override retrieved data depending on the group of the user. If the user is an admin I want those fields values to be changed to placeholders like
Since I created an
encrypted Type, I tried to get user group from Session or with UserAuth methods but I can access these (or I don’t know how) from EncryptedType Class (located in
If I could know the user group by that time, I could make
toPHP() method to return data depending on user group.
Then, I tried using afterFind method but it was deprecated.
I don’t want to use mapReduce() on every get(), find() or query() statement.
Is it possible to replace retrieved data with a Behavior?
(or inside EncryptedType::toPHP() method, *see above)