Scenario:
I was suppose to write a webpart that display edit panel only if the user has certian permissions.
Solution:
I used SPSecurityTrimmedControl in my code behind
Code:
public void override CreateChildcontrols(){
SPSecurityTrimmedControl stcEdit= new SPSecurityTrimmedControl();
stcEdit.Permissions = SPBasePermissions.EditListItems;
Panel pnlEdit = new Panel();
stcEdit.Controls.Add(pnlEdit);
this.Controls.Add(stcEditItem);
}
0 comments:
Post a Comment