657
657
required=False, default=False)
660
class IPersonPublic(IHasBranches, IHasSpecifications,
661
IHasMergeProposals, IHasLogo, IHasMugshot, IHasIcon,
662
IHasLocation, IHasRequestedReviews, IObjectWithLocation,
663
IPrivacy, IHasBugs, IHasRecipes, IHasTranslationImports,
664
IPersonSettings, IQuestionsPerson):
665
"""Public attributes for a Person."""
660
class IPersonPublic(IPrivacy):
661
"""Public attributes for a Person.
663
Very few attributes on a person can be public because private teams
664
are also persons. The public attributes are generally information
665
needed by the system to determine if the principal in the current
666
interaction can work with the object.
667
669
id = Int(title=_('ID'), required=True, readonly=True)
668
account = Object(schema=IAccount)
669
accountID = Int(title=_('Account ID'), required=True, readonly=True)
670
password = PasswordField(
671
title=_('Password'), required=True, readonly=False)
673
Int(title=_('Karma'), readonly=True,
674
description=_('The cached total karma for this person.')))
675
homepage_content = exported(
676
Text(title=_("Homepage Content"), required=False,
678
"The content of your profile page. Use plain text, "
679
"paragraphs are preserved and URLs are linked in pages.")))
670
# This is redefined from IPrivacy.private because the attribute is
671
# read-only. It is a summary of the team's visibility.
672
private = exported(Bool(
673
title=_("This team is private"),
674
readonly=True, required=False,
675
description=_("Private teams are visible only to "
677
is_valid_person = Bool(
678
title=_("This is an active user and not a team."), readonly=True)
679
is_valid_person_or_team = exported(
680
Bool(title=_("This is an active user or a team."), readonly=True),
681
exported_as='is_valid')
682
is_merge_pending = exported(Bool(
683
title=_("Is this person due to be merged with another?"),
684
required=False, default=False))
686
Bool(title=_('Is this object a team?'), readonly=True))
687
account_status = Choice(
688
title=_("The status of this person's account"), required=False,
689
readonly=True, vocabulary=AccountStatus)
690
account_status_comment = Text(
691
title=_("Why are you deactivating your account?"), required=False,
695
class IPersonLimitedView(IHasIcon, IHasLogo):
696
"""IPerson attributes that require launchpad.LimitedView permission."""
700
title=_('Name'), required=True, readonly=False,
701
constraint=name_validator,
703
"A short unique name, beginning with a lower-case "
704
"letter or number, and containing only letters, "
705
"numbers, dots, hyphens, or plus signs.")))
706
displayname = exported(
708
title=_('Display Name'), required=True, readonly=False,
710
"Your name as you would like it displayed throughout "
711
"Launchpad. Most people use their full name here.")),
712
exported_as='display_name')
713
unique_displayname = TextLine(
714
title=_('Return a string of the form $displayname ($name).'))
680
715
# NB at this stage we do not allow individual people to have their own
681
716
# icon, only teams get that. People can however have a logo and mugshot
682
717
# The icon is only used for teams; that's why we use /@@/team as the
701
735
"is a logo, a small picture or a personal mascot. It should "
702
736
"be no bigger than 50kb in size.")))
703
737
logoID = Int(title=_('Logo ID'), required=True, readonly=True)
738
# title is required for the Launchpad Page Layout main template
739
title = Attribute('Person Page Title')
740
is_probationary = exported(
741
Bool(title=_("Is this a probationary user?"), readonly=True))
743
@operation_parameters(
744
name=TextLine(required=True, constraint=name_validator))
745
@operation_returns_entry(Interface) # Really IArchive.
746
@export_read_operation()
747
@operation_for_version("beta")
748
def getPPAByName(name):
749
"""Return a PPA with the given name if it exists.
751
:param name: A string with the exact name of the ppa being looked up.
752
:raises: `NoSuchPPA` if a suitable PPA could not be found.
754
:return: a PPA `IArchive` record corresponding to the name.
758
class IPersonViewRestricted(IHasBranches, IHasSpecifications,
759
IHasMergeProposals, IHasMugshot,
760
IHasLocation, IHasRequestedReviews, IObjectWithLocation,
761
IHasBugs, IHasRecipes, IHasTranslationImports,
762
IPersonSettings, IQuestionsPerson):
763
"""IPerson attributes that require launchpad.View permission."""
764
account = Object(schema=IAccount)
765
accountID = Int(title=_('Account ID'), required=True, readonly=True)
766
password = PasswordField(
767
title=_('Password'), required=True, readonly=False)
769
Int(title=_('Karma'), readonly=True,
770
description=_('The cached total karma for this person.')))
771
homepage_content = exported(
772
Text(title=_("Homepage Content"), required=False,
774
"The content of your profile page. Use plain text, "
775
"paragraphs are preserved and URLs are linked in pages.")))
705
777
mugshot = exported(MugshotImageUpload(
706
778
title=_("Mugshot"), required=False,
755
827
readonly=False, required=False,
756
828
value_type=Reference(schema=ISSHKey)))
758
account_status = Choice(
759
title=_("The status of this person's account"), required=False,
760
readonly=True, vocabulary=AccountStatus)
762
account_status_comment = Text(
763
title=_("Why are you deactivating your account?"), required=False,
766
830
# Properties of the Person object.
767
831
karma_category_caches = Attribute(
768
832
'The caches of karma scores, by karma category.')
770
Bool(title=_('Is this object a team?'), readonly=True))
771
is_valid_person = Bool(
772
title=_("This is an active user and not a team."), readonly=True)
773
is_valid_person_or_team = exported(
774
Bool(title=_("This is an active user or a team."), readonly=True),
775
exported_as='is_valid')
776
is_probationary = exported(
777
Bool(title=_("Is this a probationary user?"), readonly=True))
778
833
is_ubuntu_coc_signer = exported(
779
834
Bool(title=_("Signed Ubuntu Code of Conduct"),
987
1038
readonly=True, required=False,
988
1039
value_type=Reference(schema=Interface))) # HWSubmission
990
# This is redefined from IPrivacy.private because the attribute is
991
# read-only. It is a summary of the team's visibility.
992
private = exported(Bool(
993
title=_("This team is private"),
994
readonly=True, required=False,
995
description=_("Private teams are visible only to "
998
is_merge_pending = exported(Bool(
999
title=_("Is this person due to be merged with another?"),
1000
required=False, default=False))
1002
1041
administrated_teams = Attribute(
1003
1042
u"the teams that this person/team is an administrator of.")
1463
1488
:return: a boolean.
1467
class IPersonLimitedView(Interface):
1468
"""IPerson attributes that require launchpad.LimitedView permission."""
1472
title=_('Name'), required=True, readonly=False,
1473
constraint=name_validator,
1475
"A short unique name, beginning with a lower-case "
1476
"letter or number, and containing only letters, "
1477
"numbers, dots, hyphens, or plus signs.")))
1478
displayname = exported(
1480
title=_('Display Name'), required=True, readonly=False,
1482
"Your name as you would like it displayed throughout "
1483
"Launchpad. Most people use their full name here.")),
1484
exported_as='display_name')
1485
unique_displayname = TextLine(
1486
title=_('Return a string of the form $displayname ($name).'))
1489
class IPersonViewRestricted(Interface):
1490
"""IPerson attributes that require launchpad.View permission."""
1492
1491
active_member_count = Attribute(
1493
1492
"The number of real people who are members of this team.")
1494
1493
# activemembers.value_type.schema will be set to IPerson once
2566
2565
IPersonViewRestricted[name].value_type.schema = IPerson
2568
IPersonPublic['sub_teams'].value_type.schema = ITeam
2569
IPersonPublic['super_teams'].value_type.schema = ITeam
2567
IPersonViewRestricted['sub_teams'].value_type.schema = ITeam
2568
IPersonViewRestricted['super_teams'].value_type.schema = ITeam
2570
2569
# XXX: salgado, 2008-08-01: Uncomment these when teams_*participated_in are
2571
2570
# exported again.
2572
# IPersonPublic['teams_participated_in'].value_type.schema = ITeam
2573
# IPersonPublic['teams_indirectly_participated_in'].value_type.schema = ITeam
2571
# IPersonViewRestricted['teams_participated_in'].value_type.schema = ITeam
2572
# IPersonViewRestricted[
2573
# 'teams_indirectly_participated_in'].value_type.schema = ITeam
2575
2575
# Fix schema of operation parameters. We need zope.deferredimport!
2576
2576
params_to_fix = [
2577
2577
# XXX: salgado, 2008-08-01: Uncomment these when they are exported again.
2578
# (IPersonPublic['findPathToTeam'], 'team'),
2579
# (IPersonPublic['inTeam'], 'team'),
2578
# (IPersonViewRestricted['findPathToTeam'], 'team'),
2579
# (IPersonViewRestricted['inTeam'], 'team'),
2580
2580
(IPersonEditRestricted['join'], 'team'),
2581
2581
(IPersonEditRestricted['leave'], 'team'),
2582
2582
(IPersonEditRestricted['addMember'], 'person'),