Пример #1
0
class DBRedmineIssueExt(object):

    __storm_table__ = 'issues_ext_redmine'

    id = Int(primary=True)
    category_id = Int()
    done_ratio = Int()
    due_date = DateTime()
    estimated_hours = Int()
    fixed_version_id = Int()
    lft = Int()
    rgt = Int()
    lock_version = Int()
    parent_id = Int()
    project_id = Int()
    root_id = Int()
    start_date = DateTime()
    # WARNING: this tracker_id is not related to trackers table,
    # it's a field from Redmine
    tracker_id = Int()
    updated_on = DateTime()
    issue_id = Int()

    issue = Reference(issue_id, DBIssue.id)

    def __init__(self, issue_id):
        self.issue_id = issue_id
Пример #2
0
class ArchiveAuthToken(Storm):
    """See `IArchiveAuthToken`."""
    implements(IArchiveAuthToken)
    __storm_table__ = 'ArchiveAuthToken'

    id = Int(primary=True)

    archive_id = Int(name='archive', allow_none=False)
    archive = Reference(archive_id, 'Archive.id')

    person_id = Int(name='person', allow_none=False)
    person = Reference(person_id, 'Person.id')

    date_created = DateTime(
        name='date_created', allow_none=False, tzinfo=pytz.UTC)

    date_deactivated = DateTime(
        name='date_deactivated', allow_none=True, tzinfo=pytz.UTC)

    token = Unicode(name='token', allow_none=False)

    def deactivate(self):
        """See `IArchiveAuthTokenSet`."""
        self.date_deactivated = UTC_NOW

    @property
    def archive_url(self):
        """Return a custom archive url for basic authentication."""
        normal_url = URI(self.archive.archive_url)
        auth_url = normal_url.replace(
            userinfo="%s:%s" %(self.person.name, self.token))
        return str(auth_url)
Пример #3
0
class DBBugzillaIssuesLog(DBIssuesLog):
    """
    """
    __storm_table__ = 'issues_log_bugzilla'
    alias = Unicode()
    delta_ts = DateTime()
    reporter_accessible = Unicode()
    cclist_accessible = Unicode()
    classification_id = Unicode()
    classification = Unicode()
    product = Unicode()
    component = Unicode()
    version = Unicode()
    rep_platform = Unicode()
    op_sys = Unicode()
    dup_id = Int()
    bug_file_loc = Unicode()
    status_whiteboard = Unicode()
    target_milestone = Unicode()
    votes = Int()
    everconfirmed = Unicode()
    qa_contact = Unicode()
    estimated_time = Unicode()
    remaining_time = Unicode()
    actual_time = Unicode()
    deadline = DateTime()
    keywords = Unicode()
    cc = Unicode()
    group_bugzilla = Unicode()
    flag = Unicode()
    issue_id = Int()
Пример #4
0
class InternalTip(Model):
    """
    This is the internal representation of a Tip that has been submitted to the
    GlobaLeaks node.

    It has a not associated map for keep track of Receivers, Tips,
    Comments and WhistleblowerTip.
    All of those element has a Storm Reference with the InternalTip.id,
    never vice-versa
    """
    __storm_table__ = 'internaltip'

    context_id = Unicode()
    #context = Reference(InternalTip.context_id, Context.id)
    #comments = ReferenceSet(InternalTip.id, Comment.internaltip_id)
    #receivertips = ReferenceSet(InternalTip.id, ReceiverTip.internaltip_id)
    #internalfiles = ReferenceSet(InternalTip.id, InternalFile.internaltip_id)
    #receivers = ReferenceSet(InternalTip.id, Receiver.id)

    wb_fields = Pickle(validator=dict_v)
    pertinence_counter = Int()
    expiration_date = DateTime()
    last_activity = DateTime()

    # the LIMITS are stored in InternalTip because and admin may
    # need change them. These values are copied by Context
    escalation_threshold = Int()
    access_limit = Int()
    download_limit = Int()

    mark = Unicode()

    _marker = [u'submission', u'finalize', u'first', u'second']
Пример #5
0
class ReceiverTip_v_19(Model):
    __storm_table__ = 'receivertip'
    internaltip_id = Unicode()
    receiver_id = Unicode()
    last_access = DateTime()
    access_counter = Int()
    notification_date = DateTime()
    mark = Unicode()
Пример #6
0
class InternalTip_v_20(Model):
    __storm_table__ = 'internaltip'
    creation_date = DateTime()
    context_id = Unicode()
    wb_steps = JSON()
    expiration_date = DateTime()
    last_activity = DateTime()
    new = Int()
Пример #7
0
class User_v_14(Model):
    __storm_table__ = 'user'
    creation_date = DateTime()
    username = Unicode()
    password = Unicode()
    salt = Unicode()
    role = Unicode()
    state = Unicode()
    last_login = DateTime()
Пример #8
0
class ReceiverTip_v_23(ModelWithID):
    __storm_table__ = 'receivertip'
    internaltip_id = Unicode()
    receiver_id = Unicode()
    last_access = DateTime()
    access_counter = Int()
    notification_date = DateTime()
    label = Unicode()
    new = Int()
Пример #9
0
class InternalTip_v_19(Model):
    __storm_table__ = 'internaltip'
    creation_date = DateTime()
    context_id = Unicode()
    wb_steps = JSON()
    expiration_date = DateTime()
    last_activity = DateTime()
    access_limit = Int()
    download_limit = Int()
    mark = Unicode()
Пример #10
0
class User_version_5(Model):
    __storm_table__ = 'user'

    username = Unicode()
    password = Unicode()
    salt = Unicode()
    role = Unicode()
    state = Unicode()
    last_login = DateTime()
    first_failed = DateTime()
    failed_login_count = Int()
Пример #11
0
class InternalTip_v_22(ModelWithID):
    __storm_table__ = 'internaltip'
    creation_date = DateTime()
    context_id = Unicode()
    wb_steps = JSON()
    preview = JSON()
    progressive = Int()
    tor2web = Bool()
    expiration_date = DateTime()
    last_activity = DateTime()
    new = Int()
Пример #12
0
class InternalTip_v_10(Model):  # no change at all!
    __storm_table__ = 'internaltip'
    context_id = Unicode()
    wb_fields = Pickle()
    pertinence_counter = Int()
    expiration_date = DateTime()
    last_activity = DateTime()
    escalation_threshold = Int()
    access_limit = Int()
    download_limit = Int()
    mark = Unicode()
Пример #13
0
class InternalTip_v_23(Model):
    __storm_table__ = 'internaltip'
    creation_date = DateTime()
    context_id = Unicode()
    questionnaire_hash = Unicode()
    preview = JSON()
    progressive = Int()
    tor2web = Bool()
    expiration_date = DateTime()
    last_activity = DateTime()
    new = Int()
Пример #14
0
class DBGoogleCodeIssueExt(object):
    __storm_table__ = 'issues_ext_googlecode'

    id = Int(primary=True)
    ticket_num = Int()
    closed_date = DateTime()
    mod_date = DateTime()
    issue_id = Int()

    issue = Reference(issue_id, DBIssue.id)

    def __init__(self, issue_id):
        self.issue_id = issue_id
Пример #15
0
class User_v_20(Model):
    __storm_table__ = 'user'
    creation_date = DateTime()
    username = Unicode()
    password = Unicode()
    salt = Unicode()
    role = Unicode()
    state = Unicode()
    last_login = DateTime()
    language = Unicode()
    timezone = Int()
    password_change_needed = Bool()
    password_change_date = DateTime()
Пример #16
0
class BuildFarmJob(Storm):
    """A base implementation for `IBuildFarmJob` classes."""
    __storm_table__ = 'BuildFarmJob'

    id = Int(primary=True)

    date_created = DateTime(name='date_created',
                            allow_none=False,
                            tzinfo=pytz.UTC)

    date_finished = DateTime(name='date_finished',
                             allow_none=True,
                             tzinfo=pytz.UTC)

    builder_id = Int(name='builder', allow_none=True)
    builder = Reference(builder_id, 'Builder.id')

    status = DBEnum(name='status', allow_none=False, enum=BuildStatus)

    job_type = DBEnum(name='job_type', allow_none=False, enum=BuildFarmJobType)

    archive_id = Int(name='archive')
    archive = Reference(archive_id, 'Archive.id')

    def __init__(self,
                 job_type,
                 status=BuildStatus.NEEDSBUILD,
                 date_created=None,
                 builder=None,
                 archive=None):
        super(BuildFarmJob, self).__init__()
        (self.job_type, self.status, self.builder,
         self.archive) = (job_type, status, builder, archive)
        if date_created is not None:
            self.date_created = date_created

    @classmethod
    def new(cls,
            job_type,
            status=BuildStatus.NEEDSBUILD,
            date_created=None,
            builder=None,
            archive=None):
        """See `IBuildFarmJobSource`."""
        build_farm_job = BuildFarmJob(job_type, status, date_created, builder,
                                      archive)
        store = IMasterStore(BuildFarmJob)
        store.add(build_farm_job)
        return build_farm_job
Пример #17
0
class TagValue(Storm):
    """A value for L{Tag}.

    @param creatorID: The L{User.id} of the person creating this value.
    @param tagID: The L{Tag.id} this value is for.
    @param objectID: The object this value is for.
    @param value: The value to store.
    """

    __storm_table__ = 'tag_values'

    id = Int('id', primary=True, allow_none=False)
    creatorID = Int('creator_id', allow_none=False)
    tagID = Int('tag_id', allow_none=False)
    objectID = UUID('object_id', allow_none=False)
    creationTime = DateTime('creation_time', default=AutoReload)
    value = BinaryJSON('value', validator=validateTagValue)

    tag = Reference(tagID, 'Tag.id')
    creator = Reference(creatorID, 'User.id')

    def __init__(self, creatorID, tagID, objectID, value):
        self.creatorID = creatorID
        self.tagID = tagID
        self.objectID = objectID
        self.value = value
Пример #18
0
class QuestionSubscription(SQLBase):
    """A subscription for person to a question."""

    _table = 'QuestionSubscription'

    id = Int(primary=True)
    question_id = Int("question", allow_none=False)
    question = ForeignKey(dbName='question',
                          foreignKey='Question',
                          notNull=True)

    person_id = Int("person",
                    allow_none=False,
                    validator=validate_public_person)
    person = ForeignKey(dbName='person',
                        foreignKey='Person',
                        storm_validator=validate_public_person,
                        notNull=True)

    date_created = DateTime(allow_none=False, default=UTC_NOW, tzinfo=pytz.UTC)

    def canBeUnsubscribedByUser(self, user):
        """See `IQuestionSubscription`."""
        if user is None:
            return False
        # The people who can unsubscribe someone are:
        # - lp admins
        # - the person themselves
        # - the question owner
        # - people who can reject questions (eg target owner, answer contacts)
        return (user.inTeam(self.question.owner) or user.inTeam(self.person)
                or IPersonRoles(user).in_admin
                or self.question.canReject(user))
Пример #19
0
class Context_v_8(Model):
    """
    This model keeps track of specific contexts settings
    """
    __storm_table__ = 'context'
    unique_fields = Pickle()
    localized_fields = Pickle()
    selectable_receiver = Bool()
    escalation_threshold = Int()
    tip_max_access = Int()
    file_max_download = Int()
    file_required = Bool()
    tip_timetolive = Int()
    submission_timetolive = Int()
    receipt_regexp = Unicode()
    last_update = DateTime()
    tags = Pickle()
    name = Pickle()
    description = Pickle()
    receiver_introduction = Pickle()
    fields_introduction = Pickle()
    select_all_receivers = Bool()
    postpone_superpower = Bool()
    can_delete_submission = Bool()
    maximum_selectable_receivers = Int()
    require_file_description = Bool()
    delete_consensus_percentage = Int()
    require_pgp = Bool()
    show_small_cards = Bool()
Пример #20
0
class Context_v_13(Model):
    __storm_table__ = 'context'
    unique_fields = Pickle()
    localized_fields = Pickle()
    selectable_receiver = Bool()
    escalation_threshold = Int()
    tip_max_access = Int()
    file_max_download = Int()
    file_required = Bool()
    tip_timetolive = Int()
    submission_timetolive = Int()
    last_update = DateTime()
    tags = Pickle()
    name = Pickle()
    description = Pickle()
    receiver_introduction = Pickle()
    fields_introduction = Pickle()
    select_all_receivers = Bool()
    postpone_superpower = Bool()
    can_delete_submission = Bool()
    maximum_selectable_receivers = Int()
    require_file_description = Bool()
    delete_consensus_percentage = Int()
    require_pgp = Bool()
    show_small_cards = Bool()
    show_receivers = Bool()
    presentation_order = Int()
Пример #21
0
class DBIssuesLog(object):
    """
    """
    #__storm_table__ = 'issues_log_bugzilla'
    id = Int(primary=True)
    #
    issue_id = Int()
    issue = Unicode()
    type = Unicode()
    summary = Unicode()
    description = Unicode()
    status = Unicode()
    resolution = Unicode()
    priority = Unicode()
    submitted_by = Int()
    date = DateTime()
    assigned_to = Int()
    tracker_id = Int()
    #

    tracker = Reference(tracker_id, DBTracker.id)
    submitted = Reference(submitted_by, DBPeople.id)
    assigned = Reference(assigned_to, DBPeople.id)

    def __init__(self, issue, tracker_id):
        self.issue = unicode(issue)
        self.tracker_id = tracker_id
Пример #22
0
class Receiver_version_7(Model):
    __storm_table__ = 'receiver'

    user_id = Unicode()
    name = Unicode()
    description = Pickle()
    gpg_key_info = Unicode()
    gpg_key_fingerprint = Unicode()
    gpg_key_status = Unicode()
    gpg_key_armor = Unicode()
    gpg_enable_notification = Bool()
    gpg_enable_files = Bool()
    receiver_level = Int()
    last_update = DateTime()
    tags = Pickle()
    tip_notification = Bool()
    file_notification = Bool()
    comment_notification = Bool()
    # + is added
    # message_notification = Bool()

    # this is going to be removed
    notification_fields = Pickle()
    # + and substituted without being a dict
    # mail_address = Unicode()

    can_delete_submission = Bool()
Пример #23
0
class Receiver(Model):
    """
    name, description, password and notification_fields, can be changed
    by Receiver itself
    """
    __storm_table__ = 'receiver'

    user_id = Unicode()
    # Receiver.user = Reference(Receiver.user_id, User.id)

    name = Unicode(validator=shorttext_v)

    # localization string
    description = Pickle(validator=longlocal_v)

    # of GPG key fields
    gpg_key_info = Unicode()
    gpg_key_fingerprint = Unicode()
    gpg_key_status = Unicode()
    gpg_key_armor = Unicode()
    gpg_enable_notification = Bool()

    _gpg_types = [u'Disabled', u'Enabled']

    # Can be changed and can be different from username!
    mail_address = Unicode()

    # Admin chosen options
    can_delete_submission = Bool()
    postpone_superpower = Bool()

    # receiver_tier = 1 or 2. Mean being part of the first or second level
    # of receivers body. if threshold is configured in the context. default 1
    receiver_level = Int()

    last_update = DateTime()

    # Group which the Receiver is part of
    tags = Pickle()

    # personal advanced settings
    tip_notification = Bool()
    comment_notification = Bool()
    file_notification = Bool()
    message_notification = Bool()

    # contexts = ReferenceSet("Context.id",
    #                         "ReceiverContext.context_id",
    #                         "ReceiverContext.receiver_id",
    #                         "Receiver.id")

    presentation_order = Int()

    unicode_keys = ['name', 'mail_address']
    localized_strings = ['description']
    int_keys = ['receiver_level', 'presentation_order']
    bool_keys = [
        'can_delete_submission', 'tip_notification', 'comment_notification',
        'file_notification', 'message_notification', 'postpone_superpower'
    ]
Пример #24
0
class Node_version_5(Model):
    __storm_table__ = 'node'

    name = Unicode()
    public_site = Unicode()
    hidden_service = Unicode()
    email = Unicode()
    receipt_salt = Unicode()
    last_update = DateTime()
    database_version = Int()
    languages_supported = Pickle()
    languages_enabled = Pickle()
    default_language = Unicode()
    description = Pickle()
    presentation = Pickle()
    stats_update_time = Int()
    maximum_namesize = Int()
    maximum_descsize = Int()
    maximum_textsize = Int()
    maximum_filesize = Int()
    tor2web_admin = Bool()
    tor2web_submission = Bool()
    tor2web_tip = Bool()
    tor2web_receiver = Bool()
    tor2web_unauth = Bool()
    exception_email = Unicode()
Пример #25
0
class WhistleblowerTip_v_32(models.ModelWithID):
    __storm_table__ = 'whistleblowertip'
    internaltip_id = Unicode()
    receipt_hash = Unicode()

    last_access = DateTime(default_factory=datetime_now)
    access_counter = Int(default=0)
Пример #26
0
class BugSubscription(StormBase):
    """A relationship between a person and a bug."""

    __storm_table__ = 'BugSubscription'

    id = Int(primary=True)

    person_id = Int("person", allow_none=False, validator=validate_person)
    person = Reference(person_id, "Person.id")

    bug_id = Int("bug", allow_none=False)
    bug = Reference(bug_id, "Bug.id")

    bug_notification_level = DBEnum(enum=BugNotificationLevel,
                                    default=BugNotificationLevel.COMMENTS,
                                    allow_none=False)

    date_created = DateTime(allow_none=False, default=UTC_NOW, tzinfo=pytz.UTC)

    subscribed_by_id = Int("subscribed_by",
                           allow_none=False,
                           validator=validate_person)
    subscribed_by = Reference(subscribed_by_id, "Person.id")

    def __init__(self,
                 bug=None,
                 person=None,
                 subscribed_by=None,
                 bug_notification_level=BugNotificationLevel.COMMENTS):
        super(BugSubscription, self).__init__()
        self.bug = bug
        self.person = person
        self.subscribed_by = subscribed_by
        self.bug_notification_level = bug_notification_level

    @property
    def display_subscribed_by(self):
        """See `IBugSubscription`."""
        if self.person_id == self.subscribed_by_id:
            return u'Self-subscribed'
        else:
            return u'Subscribed by %s (%s)' % (self.subscribed_by.displayname,
                                               self.subscribed_by.name)

    @property
    def display_duplicate_subscribed_by(self):
        """See `IBugSubscription`."""
        if self.person == self.subscribed_by:
            return u'Self-subscribed to bug %s' % (self.bug_id)
        else:
            return u'Subscribed to bug %s by %s (%s)' % (
                self.bug_id, self.subscribed_by.displayname,
                self.subscribed_by.name)

    def canBeUnsubscribedByUser(self, user):
        """See `IBugSubscription`."""
        if user is None:
            return False
        return (user.inTeam(self.person) or user.inTeam(self.subscribed_by)
                or IPersonRoles(user).in_admin)
Пример #27
0
class Node_v_13(Model):
    __storm_table__ = 'node'
    name = Unicode()
    public_site = Unicode()
    hidden_service = Unicode()
    email = Unicode()
    receipt_salt = Unicode()
    last_update = DateTime()
    receipt_regexp = Unicode()
    languages_enabled = Pickle()
    default_language = Unicode()
    description = Pickle()
    presentation = Pickle()
    footer = Pickle()
    subtitle = Pickle()
    terms_and_conditions = Pickle()
    stats_update_time = Int()
    maximum_namesize = Int()
    maximum_textsize = Int()
    maximum_filesize = Int()
    tor2web_admin = Bool()
    tor2web_submission = Bool()
    tor2web_receiver = Bool()
    tor2web_unauth = Bool()
    allow_unencrypted = Bool()
    postpone_superpower = Bool()
    can_delete_submission = Bool()
    ahmia = Bool()
    wizard_done = Bool()
    anomaly_checks = Bool()
    exception_email = Unicode()
Пример #28
0
class ArchiveFile(Storm):
    """See `IArchiveFile`."""

    __storm_table__ = 'ArchiveFile'

    id = Int(primary=True)

    archive_id = Int(name='archive', allow_none=False)
    archive = Reference(archive_id, 'Archive.id')

    container = Unicode(name='container', allow_none=False)

    path = Unicode(name='path', allow_none=False)

    library_file_id = Int(name='library_file', allow_none=False)
    library_file = Reference(library_file_id, 'LibraryFileAlias.id')

    scheduled_deletion_date = DateTime(name='scheduled_deletion_date',
                                       tzinfo=pytz.UTC,
                                       allow_none=True)

    def __init__(self, archive, container, path, library_file):
        """Construct an `ArchiveFile`."""
        super(ArchiveFile, self).__init__()
        self.archive = archive
        self.container = container
        self.path = path
        self.library_file = library_file
        self.scheduled_deletion_date = None
Пример #29
0
class Node_version_9(Model):
    __storm_table__ = 'node'

    name = Unicode()
    public_site = Unicode()
    hidden_service = Unicode()
    email = Unicode()
    receipt_salt = Unicode()
    last_update = DateTime()
    languages_enabled = Pickle()
    default_language = Unicode()
    description = Pickle()
    presentation = Pickle()
    footer = Pickle()
    subtitle = Pickle()
    stats_update_time = Int()
    maximum_namesize = Int()
    maximum_textsize = Int()
    maximum_filesize = Int()
    tor2web_admin = Bool()
    tor2web_submission = Bool()
    tor2web_receiver = Bool()
    tor2web_unauth = Bool()
    postpone_superpower = Bool()
    can_delete_submission = Bool()
    ahmia = Bool()
    exception_email = Unicode()
Пример #30
0
class DBJiraIssueExt(object):
    """
    """
    __storm_table__ = 'issues_ext_jira'

    id = Int(primary=True)
    issue_key = Unicode()
    link = Unicode()
    title = Unicode()
    environment = Unicode()
    security = Unicode()
    updated = DateTime()
    version = Unicode()
    fix_version = Unicode()
    component = Unicode()
    votes = Int()
    project = Unicode()
    project_id = Int
    project_key = Unicode()
    status = Unicode()
    resolution = Unicode()

    issue_id = Int()

    issue = Reference(issue_id, DBIssue.id)

    def __init__(self, issue_id):
        self.issue_id = issue_id