Improve CheckPermissions function. Check separately member and admin+tokenmaster permissions.. Issue #12884