Updated Answer after question was updated with more understanding.
Well as you have said that we can remove the Quick Edit
link via list setting in Advance Settings
option, but unfortunately that hides link for all users irrespective of admin or not.
So I doubt you have any OOB solution which will take care of your requirement. You need some custom solution.
All I can think of a JSOM
code which gets the current logged in user and identifies whether he/she is site admin or not, If site admin show link or else hide it.
That function is below:
function chkCurrentUserIfAdmin() {
try {
var clientContext = new SP.ClientContext.get_current();
var tempcurrentUser = clientContext.get_web().get_currentUser();
clientContext.load(tempcurrentUser);
clientContext.executeQueryAsync(function () {
var index = tempcurrentUser.get_loginName().indexOf('|') + 1;
var currentUser = tempcurrentUser.get_loginName().substring(index);
var isSiteAdmin = tempcurrentUser.get_isSiteAdmin();
if(!isSiteAdmin) {
$("#Hero-WPQ2 a:nth-child(2)").remove();
var tempHtml = $("#Hero-WPQ2").html();
tempHtml = tempHtml.replace('or this list', '');
$("#Hero-WPQ2").html(tempHtml);
}
}, function () {
console.log("error");
});
}
catch (err) {
console.log("error");
}
}
But still the main question remains, is how and from where to call it? Well there are 2 options
- Place a Content Editor Web Part on your view page: But I believe this is not portable solution, and will have difficulty while moving to Production.
- Use
JSLink
: the main purpose of JSLink
is to modify the rendering of the items on a view, but here we can use it as we need to apply something on a view keeping the item design as it is.
Below is the complete JSLink
file code. make a file showhideEditLink.js
paste below code in it, and upload where ever you want in site.
Note: I have not removed all of the code in override function, but
just commented the line of code which actually overrides the view i.e.
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
. You can opt to remove that and just keep the document.ready
and the function
// function to process an item..
window.AZR = window.AZR || {};
window.AZR.ListItem = {
customItemHtml: function (ctx) {
var ListItemHtml = "<h3>" + ctx.CurrentItem.Title + "</h3>";
ListItemHtml += "<div>" + ctx.CurrentItem.PrivacyStatementUrls + "</div>";
return ListItemHtml;
}
};
// anonymous self-executing function to setup JSLink templates on page load..
(function () {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Header = "<div id=\"accordion\">";
overrideCtx.Templates.Item = window.AZR.ListItem.customItemHtml;
overrideCtx.Templates.Footer = "</div>";
overrideCtx.BaseViewID = 1;
overrideCtx.ListTemplateType = 10000;
//SPClientTemplates.TemplateManager.RegisterTemplateOverrides(overrideCtx);
})();
function chkCurrentUserIfAdmin() {
try {
var clientContext = new SP.ClientContext.get_current();
var tempcurrentUser = clientContext.get_web().get_currentUser();
clientContext.load(tempcurrentUser);
clientContext.executeQueryAsync(function () {
var index = tempcurrentUser.get_loginName().indexOf('|') + 1;
var currentUser = tempcurrentUser.get_loginName().substring(index);
var isSiteAdmin = tempcurrentUser.get_isSiteAdmin();
if(!isSiteAdmin) {
$("#Hero-WPQ2 a:nth-child(2)").remove();
var tempHtml = $("#Hero-WPQ2").html();
tempHtml = tempHtml.replace('or this list', '');
$("#Hero-WPQ2").html(tempHtml);
}
}, function () {
console.log("error");
});
}
catch (err) {
console.log("error");
}
}
$(document).ready(function () {
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', chkCurrentUserIfAdmin);
});
Now you need to set this JSLink
to your view. Refer Setting JSLink SharePoint online
Also if you are unaware of JSLink
then go through Using JSLink to change the UI of a SharePoint list/view
Old Answer and approach below
Summing up NkSP's and Eric Alexander's answers into one.
To achieve this we can divide the work into 2 stages.
- Create permission levels
- Assign levels to list
Create permission levels:
- go to site settings of your
Root Site
- Click on
Site Permissions
under Users and Permissions
section
- Click on
Permission Levels
from ribbon (Refer below screen shot)

- Add a new level(Refer screen shot)

- As mentioned by @NkSP create 2 levels first with
Add
and View
items permissions and second with View
items permission only.
Assign levels to list:
- Go to your list open up ribbon and click on
List Settings
Click on Permissions for this list
From the ribbon you can Stop inheriting permissions
. This will break the original Site's permission and give you a chance to set your own permissions on the List.

Select your Group
and from ribbon click on Edit user permissions

On the next page you will see your Newly Created Permission Levels
. Select them and save.
This is how you give permissions to Group
, and lastly Go back to permissions page, From ribbon Click on Grant Permissions
and add your specific administrators
with whatever permissions you want to give.

Quick Edit
link to be disappeared. But want users to do normal operations like view, add, edit and delete? But also you would want only administrators to see this link. Correct me if I am wrong. – Asad Refai Aug 13 '15 at 7:35