Solapas principales

Coty Embry · Ago 19, 2017

Get user info on file change of .js and .* files

I was wondering if there was a way to if the user is using Studio and changes a file to get the users name and have a function run when the file is changed. 

Ive got this working for .int files but not for .csp or .js or .css or any other kinds of files. 

When we edit code we are logged in to the Cache backend’s server through Studio by using an iPaddress (which is on our network). 

I know now there are concepts of file locks and logs for when certain tasks are ran or when a user maybe edits a file

I was thinking there might be a way to get that Info because of the fact of being logged in through Studio somehow it would help register that. 

Our you are underlying issue is that we have one single development server which has 1 database and we can’t set up another database on another server because of our legal position. So what we have to do is all work, edit, and use 1 single server with 1 project directory/folder directory shared between us all...

I’ve got the other logic solved, but this piece - the question I’m asking - might be a deal breaker 

Any help is appreciated,

thanks for your time!

0 5 273 1


Hello Coty.

I noticed that you starred my github repository and I thank you for that. :)

Back to your question, I think you're detecting changes by applying an unusual way to do that, since you said you can't trigger an action when modifying static files. Just so you know, as long as you're working with the Studio's SourceControl API, you should be able to do whatever you want whenever an  item is modified, you're even free to decide how to restrict the implementation, all of this regardless of the item you're updating.

Look at this part to understand how it's done.

About your use-case, we're actually testing Port with this development format. We have one code base, that's our development server, multiple namespaces simulating different customer configurations and mock data (not mock, actually their test data).

Even though this model works, by our analysis it can get pretty frustrating for users coming from a distributed version control, because they notice that multiple developers interacting with their "repository". Still, it's already a step ahead from not versioning at all.

However, the team is expected to migrate all their source to projects, since Port annoys the user about trying to save default projects and even detects items that are already owned by other projects. This forces all the team to prioritize organizing their code base.

No problem, I hope your project stays active and has a long future!


Thank you for your help! I was already using the OnAfterCompile hook, but didn't realize the OnAfterSave method would work for other file times, and it did ^_^


Also, to solve my problem of getting the username, there is a variable that gets set up when a user logs in apparently called




which is what I will be using to help with my problem.

Thanks for your time and help again, I would still be working on this issue if it wasn't for you

Though not the full answer, your comment motivated me and helped me to digging through documentation online to solve my total problem within the Cache environment to get their username (rather than listening to file changes with node.js and using file auditing with Windows server for user info)

I replied with what helped me to our answer and I’ll mark yours as correct. Thanks again! Stay blessed

Good to hear Rubens helped you Coty. The best way of giving him due credit on DC is for you (as OP) to set the checkmark alongside his answer. Look for it above, in the area I've highlighted in my screenshot below: