Trigger: Remove/Unlink User from User Group After Asset Creation


(Nic Hubbard) #1

This one is stumping me.

 

I have an asset builder that I have given a User Group access to. The User asset that is within that User Group creates a new asset, and after creation I need to remove them from this group so that they no longer have access to viewing or using the Asset Builder. Sounds simple.

 

But, the events that I am using for the Trigger such as Asset Created, all target the created asset, and I can't make a reference to the USER that created the new asset in order to unlink them from that User Group.

 

Does anyone have ideas on what I could do this? 


#2

Nothing ever stumps you! Ever! Are they simple editors - just for the purpose of using the asset builder? Or are they backend users. I’m just thinking -

Maybe if the user is uploading to under a node rather than restricting the access to the asset builder you could remove the user when asset types are created under a node


But yes - I’m hearing you - still how on earth do they link together ???


(Anthony) #3

Could you use the SOAP call trigger action to calls squiz' own SOAP API remove link method and pass in %asset_created_by_assetid%? I'm assuming you'd be happy to hard code the asset id of the group you want to remove them from as the other parameter. 


(Nic Hubbard) #4

Nothing ever stumps you! Ever!

 

Ha!

 

 Are they simple editors - just for the purpose of using the asset builder? Or are they backend users. I'm just thinking -

Maybe if the user is uploading to under a node rather than restricting the access to the asset builder you could remove the user when asset types are created under a node
But yes - I'm hearing you - still how on earth do they link together ???

 

They are just standard User assets. They don't need to be Simple Edit or Backend Users.

 

I think I figured out a solution....


(Nic Hubbard) #5

Could you use the SOAP call trigger action to calls squiz' own SOAP API remove link method and pass in %asset_created_by_assetid%? I'm assuming you'd be happy to hard code the asset id of the group you want to remove them from as the other parameter. 

 

Hmm, not sure that would work for what I am needing to do.


(Bart Banda) #6

What I've done in the past is to use a REST call in a trigger that when the asset is created, it is also created with the user's asset id in its metadata somewhere. Then the trigger calls a REST Resource as an action with the asset id in the url query, for example a=%asset_metadata_id%&do=something. You then have a second trigger that listens for this REST call as asset accessed on the asset which is the user asset and then you do your unlinking in the action of that second trigger. Hopefully that high level explanation made sense and helps :) Would be a lot easier with a feature like this https://squizmap.squiz.net/matrix/5480


(Anthony) #7

Hey Bart, just for my own enlightenment: why the need for setting the metadata when there is already the asset_created_by_assetid which I’m assuming returns the id of the creating user?


(Bart Banda) #8

Hey Bart, just for my own enlightenment: why the need for setting the metadata when there is already the asset_created_by_assetid which I'm assuming returns the id of the creating user?

 

That's right, forgot about that one. Yep, you can just use that keyword. In the past I always like to set it as a metadata value as well, even if the value just contains that keyword, just so I can use it easier in things like searches and other implementations.