Determine if a record in a model is read only

I have a use case where I’d like to render a button only if the user has write access to a record and hide it when they only have read-only access.  The first solution that comes to mind is a ui-only field with a merge value, but I can’t pinpoint a documented variable and the model API doesn’t seem to have this attribute on the row level.  Ideally this would be an attribute of the {{Record}} merge variable.  

Is there a simple merge variable to check for permissions on a row?

I could also see this being useful in row actions where you may want to render an action based on access level.  

If access level is tied to a profile, you could render based on the profile of the user.

It’s based on record sharing.  That’s why the model attributes don’t work here.  

A specific example is with Salesforce Cases.  You can add Case Team members to the case with read only access so they can monitor a case that would otherwise be private based on sharing rules and role hierarchy.  This is just one example and there are several other scenarios in the SF platform.  

Would that be reflected in the CaseShare object? You might be able to attack it from there.

That’s a good idea, although it’s a little messy.  There can be several reasons why a record is shared and different access levels on the share records.  Then there’s the issue of object sharing inheritance.  For example, activities are shared based on a combination of access levels with both WhatId and WhoId.  

This is all solvable on a situational basis, but I was hoping for a quick standard solution.  Skuid is already aware of the metadata, so it seems like it would be accessible somewhere.

John, unfortunately this information is not easy for Skuid to access, which is why we don’t provide this out of the box. The information you’re looking for is not available from the user’s Profile / Schema information, it comes from the Sharing model. Raymond is on the right track with how this information could be obtained, the object you would have to query is UserRecordAccess (https://developer.salesforce.com/docs/atlas.en-us.sfFieldRef.meta/sfFieldRef/salesforce_field_reference_UserRecordAccess.htm), but it would be fairly messy, as you said, trying to query this for all records that are visible in your table, and would have to be requeried when you filter / search, etc. It’s not impossible, but the added complexity, and the added SOQL query that Skuid would have to make behind the scenes, is why Skuid doesn’t provide this functionality out of the box right now. It’s possible that you could implement this yourself, but again, it’d be messy.

Thanks for the info Zach.  I’ll see what I can come up with.