Revision 34244dfa

b/snf-astakos-app/astakos/im/functions.py
512 512

  
513 513

  
514 514
def can_leave_request(project, user):
515
    leave_policy = project.application.member_leave_policy
516
    if leave_policy == CLOSED_POLICY:
515
    try:
516
        leave_project_checks(project, user)
517
    except PermissionDenied:
517 518
        return False
518 519
    m = user.get_membership(project)
519 520
    if m is None:
520 521
        return False
521
    if m.state != ProjectMembership.ACCEPTED:
522
        return False
523
    return True
522
    return m.can_leave()
524 523

  
525 524

  
526 525
def leave_project(project_id, request_user):
......
560 559

  
561 560

  
562 561
def can_join_request(project, user):
563
    join_policy = project.application.member_join_policy
564
    if join_policy == CLOSED_POLICY:
562
    try:
563
        join_project_checks(project)
564
    except PermissionDenied:
565 565
        return False
566

  
566 567
    m = user.get_membership(project)
567
    if m:
568
        return False
569
    return True
568
    return not(m)
570 569

  
571 570

  
572 571
def join_project(project_id, request_user):

Also available in: Unified diff