Solution with no asp code:
You will need two javascript libraries:
- Jquery
- SPServices - http://spservices.codeplex.com/
In sharepoint, create a non-public library called "Jquery libraries" and upload your jquery and SPServices to it.
In sharepoint designer, create a copy of AllItems.aspx.
In sharepoint designer, edit the file AllItems.aspx. Clear all the code and insert this javascript code.
<script language="javascript" type="text/javascript" src="PATH-TO-YOUR-JQUERY-FILE"></script>
<script language="javascript" type="text/javascript" src="PATH-TO-YOUR-SPSERVICES-FILE"></script>
<script type="text/javascript">
$(document).ready(function() {
//Get current username
userName = $().SPServices.SPGetCurrentUser({
fieldName: "Name",
debug: false
});
//get user's group
$().SPServices({
operation: "GetGroupCollectionFromUser",
userLoginName: userName,
async: false,
completefunc: function(xData, status){
$(xData.responseXML).find("Group").each(function(){
if(status == "success"){
var nomeGrupo = $(this).attr('Name');
//if user is in group 1 redirect to page 1. If user is in group 2 redirect to page 2 etc...
if(nomeGrupo=="Grupo sergio"){
window.location.replace("PATH-TO-PAGE-1/SomeItems.aspx");
}else{
window.location.replace("/PATH-TO-PAGE-2/ViewAll.aspx");
}
}else{
alert("Falha na comunicação com o Sharepoint");
}
});
}
});
});
</script>
This code will redirect the user to other pages that will contain customised web-parts-view.
In sharepoint design, rename the AllItems.aspx to SomeItems.aspx (for example).
You can create multiples copys of this file and follow the next step to customise it.
Edit this file and delete the main webpart located at PlaceHolderMain.(Tip: u can click and delete if u are in split view(code an design) in sharepoint designer).
Then, you can insert a custom web part view for your list. In this custom view, you can filter data or not display some colums.