Set permissions with trigger

I am trying to use a trigger to set a user specific permission on an asset when it is created. I am trying to use a metadata value that contains the user id in the new mapping part of the set permissions action but am not having any success. Has anyone successfully implemented anything like this before? I am also trying to use the same method to set the recipient for the send email action with the same amount of failure. version is 3.18.7

There might be a bug here, I changed the mapping current user and added the metadata field to the user and it works great. Same set up using current asset does not recognise the metadata keyword.

Shane, I have a set permissions trigger working in 3.18.8 that sets permissions to the current user after they have created an asset.


How are you trying to use the metadata keyword? I am wondering if metadata keywords are even supported in this instance.

I just worked out the issue. I had set the event as status change from UC to live and was testing the trigger from the admin interface. It seems that current asset is unknown when status is changed from the admin interface but if i do it in _edit viola away we go. Ultimately this trigger will fire on asset created, i will test that one now. I had tried post and get variables before retreating to metadata as the asset gets created from an asset builder.

On second thought it is just wierdness as I have a send email action working on the same trigger that wouldn't work with mapping of the metadata field but would if I keyword replaced in a metadta field into the recips. That worked in the admin interface so there must have been some handle on the current asset. As usual though, there is always a workaround if you keep looking :wink:

Have finally cracked it. Had issues with setting permissions from a metadata field as the asset was being created from an asset builder and the asset builder is seen as the current asset by the trigger for the event of asset created. The id is being passed in as a get so I tried to set the metadata of the asset builder on access with a url match, epic matrix fail. I went back to get variables, as the id is being passed to the asset builder to set the metadata of the created asset. It is working, horay, and is the final piece in a very big puzzle.