In last post, we got all the sites, but everyone can access what we have in front end if we don't take care of Permissions.
Permission checker comes into the picture..
com.liferay.portal.security.permission.PermissionThreadLocal
com.liferay.portal.security.permission.PermissionChecker
Permission checker comes into the picture..
PermissionChecker permissionChecker = PermissionThreadLocal.getPermissionChecker();
Boolean isUserAdmin =permissionChecker.isOmniadmin();
if(permissionChecker.isOmniadmin()){// Do what you want.. no user other than admin can see this.
}Imports..
com.liferay.portal.security.permission.PermissionThreadLocal
com.liferay.portal.security.permission.PermissionChecker
That's all we need.
Enjoy. Now you have all the sites.