The following Google Apps Script is designed to change the Google Drive file permissions of a specific user from Editor to Viewer. The function actually came about when needing to end a process where a user had been editing a Google Sheet on a Shared drive that they should only then have Viewer access to. To complicate matters the Apps Script code is running as said user when it needs to reduce their own permissions.
Firstly you will need to enable the Drive API in the Script Editor by going to 'Services' > 'Drive API' > 'Add'. Next we will look to get the permission ID for the email address of the user we want to change access for:
var permissionId = Drive.Permissions.getIdForEmail('email address here').id;