Revision 62d30634 snf-astakos-app/astakos/api/projects.py

b/snf-astakos-app/astakos/api/projects.py
293 293
        is_memb = Q(id__in=memb_projects)
294 294
        owned = (Q(application__owner=request_user) |
295 295
                 Q(application__applicant=request_user))
296
        active = Project.o_state_q(Project.O_ACTIVE)
296
        active = (Project.o_state_q(Project.O_ACTIVE) &
297
                  Q(application__private=False))
297 298
        projects = projects.filter(is_memb | owned | active)
298 299
    return projects.select_related(
299 300
        "application", "application__owner", "application__applicant")
......
365 366
    return value
366 367

  
367 368

  
369
def _get_maybe_boolean(d, key):
370
    value = d.get(key)
371
    if value is not None and not isinstance(value, bool):
372
        raise faults.BadRequest("%s must be boolean" % key)
373
    return value
374

  
375

  
368 376
DOMAIN_VALUE_REGEX = re.compile(
369 377
    r'^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$',
370 378
    re.IGNORECASE)
......
414 422
    if not isinstance(max_members, (int, long)) or max_members < 0:
415 423
        raise faults.BadRequest("Invalid max_members")
416 424

  
425
    private = bool(_get_maybe_boolean(app_data, "private"))
417 426
    homepage = _get_maybe_string(app_data, "homepage")
418 427
    description = _get_maybe_string(app_data, "description")
419 428
    comments = _get_maybe_string(app_data, "comments")
......
432 441
            member_join_policy=join_policy,
433 442
            member_leave_policy=leave_policy,
434 443
            limit_on_members_number=max_members,
444
            private=private,
435 445
            comments=comments,
436 446
            resources=resources,
437 447
            request_user=user)

Also available in: Unified diff