Often I will use column in a SharePoint list as a button. This is accomplished by using column formatting to transform the column into a button.

Sometimes we only want certain users to see the button. For example, I have created a publish / share button on a SharePoint list – it makes no sense for users who can not use these features to see this button.

We can hide the column using a little known feature PermMask .

The permmask can have the following values, each attributed to a permission level:

0x1b03c431aef Edit
0xb008431041View Only
0x1b03c4312efContribute
0x1b03c5f1bffDesign
0x7fffffffffffffffAdmin

Knowing the above, we can add the following line into a the column formatting json.

  "visibility": "=if([$PermMask]<='0x1b03c5f1bff','hidden','visible')", 

The above line will set the visibility of the column to hidden if the logged in user has less access than DESIGN

The full column formatting json for my column is

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "txtContent": "Publish",
  "attributes": {
    "target": "_blank",
    "href": "='https://<mysite>/_layouts/15/AppRedirect.aspx?client_id=8cc93539-ac49-45ba-bd8d-e9a51c055891&redirect_uri=https://<myAppSite>/publish?{StandardTokens}%26sourceListId%3Ddf76f7ab-4814-4384-ad79-0fe019526f89%26destListId%3Dadf86ad9-b2fe-44ce-a0f4-b46f11e6b352%26fileId%3D' + [$ID]"
  },
  "style": {
    "visibility": "=if([$PermMask]<='0x1b03c5f1bff','hidden','visible')",
    "padding": "0px 25px",
    "cursor": "pointer",
    "border": "none",
    "color": "white",
    "font-weight": "550",
    "background-color": "#0078d4",
    "text-decoration": "none",
    "font-size": "14px",
    "text-align": "center",
    "width": "50px"
  }
}

The list shows like this for users with design or higher access

And like this for other users with less permissions