Here is some code that you can utilize for obtaining a list of SharePoint subsites that the given user has access to:
<div id="selectsubwebs"></div>
<script type="text/javascript">
var subsites = null;
var web = null;
var context = null;
var subweb = null;
var renderedHTML = "";
var scriptbase = "https://rootSiteUrl/_layouts/15/";
$.getScript(scriptbase + "SP.Runtime.js", function() {
$.getScript(scriptbase + "SP.js", function() {
$.getScript(scriptbase + "SP.RequestExecutor.js", getSubWebs);
});
});
function getSubWebs(){
context = SP.ClientContext.get_current();
web = context.get_web();
context.load(web);
context.executeQueryAsync(onGetWebSuccess, onGetWebFail);
}
function onGetWebSuccess(sender, args) {
//subsites = web.get_webs(); //Complete list of subsites
subsites = web.getSubwebsForCurrentUser(null);
context.load(webCollection);
context.executeQueryAsync(onGetSubwebsSuccess, onGetSubwebsFail);
}
function onGetSubwebsSuccess(sender, args) {
renderedHTML = renderedHTML + "<table id='table_id' class='display'><thead><tr><th>Team Site Title</th></tr></thead><tbody>";
var webEnumerator = subsites.getEnumerator();
while (webEnumerator.moveNext()){
subweb = webEnumerator.get_current();
renderedHTML = renderedHTML + "<tr><td><a href='" + subweb.get_url() + "' target='_blank'>" + subweb.get_title() + "</a></td></tr>";
}
renderedHTML = renderedHTML + "</tbody></table>";
document.getElementById("selectsubwebs").innerHTML = renderedHTML;
}
function onGetSubwebsFail(sender, args){
alert("Request to retrieve subwebs failed. Error: " + args.get_message())
}
function onGetWebFail(sender, args){
alert("Request to retrieve subwebs failed. Error: " + args.get_message())
}
</script>