Ejemplo n.º 1
0
def is_private_link_anonymous_view():
    try:
        # Avoid circular import
        from website.project.model import PrivateLink
        return PrivateLink.find_one(
            Q('key', 'eq', request.args.get('view_only'))
        ).anonymous
    except QueryException:
        return False
Ejemplo n.º 2
0
def is_private_link_anonymous_view():
    try:
        # Avoid circular import
        from website.project.model import PrivateLink
        return PrivateLink.find_one(
            Q('key', 'eq', request.args.get('view_only'))
        ).anonymous
    except QueryException:
        return False
Ejemplo n.º 3
0
def check_private_key_for_anonymized_link(private_key):
    from website.project.model import PrivateLink

    is_anonymous = False
    if private_key is not None:
        try:
            link = PrivateLink.find_one(Q('key', 'eq', private_key))
        except NoResultsFound:
            link = None
        if link is not None:
            is_anonymous = link.anonymous
    return is_anonymous
Ejemplo n.º 4
0
def check_private_key_for_anonymized_link(private_key):
    from website.project.model import PrivateLink

    is_anonymous = False
    if private_key is not None:
        try:
            link = PrivateLink.find_one(Q('key', 'eq', private_key))
        except NoResultsFound:
            link = None
        if link is not None:
            is_anonymous = link.anonymous
    return is_anonymous
Ejemplo n.º 5
0
    def private_link(self):
        if not self.private_key:
            return None
        try:
            # Avoid circular import
            from website.project.model import PrivateLink
            private_link = PrivateLink.find_one(
                Q('key', 'eq', self.private_key)
            )

            if private_link.is_deleted:
                return None

        except QueryException:
            return None

        return private_link