# Path: invenio_communities/communities/records/systemfields/owners.py
# class Owners(list):
#     """A list of owners for a record."""
# 
#     owner_cls = Owner
# 
#     def __init__(self, owners=None, owner_cls=None):
#         """Create a new list of owners."""
#         self.owner_cls = owner_cls or self.owner_cls
#         for owner in owners or []:
#             self.add(owner)
# 
#     def add(self, owner):
#         """Alias for self.append(owner)."""
#         self.append(owner)
# 
#     def append(self, owner):
#         """Add the specified owner to the list of owners.
# 
#         :param owner: The record's owner (either a dict, User or Owner).
#         """
#         if not isinstance(owner, self.owner_cls):
#             owner = self.owner_cls(owner)
# 
#         if owner not in self:
#             super().append(owner)
# 
#     def extend(self, owners):
#         """Add all new items from the specified owners to this list."""
#         for owner in owners:
#             self.add(owner)
# 
#     def remove(self, owner):
#         """Remove the specified owner from the list of owners.
# 
#         :param owner: The record's owner (either a dict, User or Owner).
#         """
#         if not isinstance(owner, self.owner_cls):
#             owner = self.owner_cls(owner)
# 
#         super().remove(owner)
# 
#     def dump(self):
#         """Dump the owners as a list of owner dictionaries."""
#         return [owner.dump() for owner in self]


from invenio_records.systemfields import SystemField
from .owners import Owners
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2021 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""Community access system field."""



class CommunityAccess:
    """Access management per community."""

    VISIBILITY_LEVELS = ('public', 'restricted')
    MEMBER_POLICY_LEVELS = ('open', 'closed')
    RECORD_POLICY_LEVELS = ('open', 'closed', 'restricted')


# Path: invenio_communities/communities/records/systemfields/owners.py
# class Owners(list):
#     """A list of owners for a record."""
# 
#     owner_cls = Owner
# 
#     def __init__(self, owners=None, owner_cls=None):
#         """Create a new list of owners."""
#         self.owner_cls = owner_cls or self.owner_cls
#         for owner in owners or []:
#             self.add(owner)
# 
#     def add(self, owner):
#         """Alias for self.append(owner)."""
#         self.append(owner)
# 
#     def append(self, owner):
#         """Add the specified owner to the list of owners.
# 
#         :param owner: The record's owner (either a dict, User or Owner).
#         """
#         if not isinstance(owner, self.owner_cls):
#             owner = self.owner_cls(owner)
# 
#         if owner not in self:
#             super().append(owner)
# 
#     def extend(self, owners):
#         """Add all new items from the specified owners to this list."""
#         for owner in owners:
#             self.add(owner)
# 
#     def remove(self, owner):
#         """Remove the specified owner from the list of owners.
# 
#         :param owner: The record's owner (either a dict, User or Owner).
#         """
#         if not isinstance(owner, self.owner_cls):
#             owner = self.owner_cls(owner)
# 
#         super().remove(owner)
# 
#     def dump(self):
#         """Dump the owners as a list of owner dictionaries."""
#         return [owner.dump() for owner in self]


# Path: invenio_communities/communities/records/systemfields/access.py
from invenio_records.systemfields import SystemField
from .owners import Owners

# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2021 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.

"""Community access system field."""



class CommunityAccess:
    """Access management per community."""

    VISIBILITY_LEVELS = ('public', 'restricted')
    MEMBER_POLICY_LEVELS = ('open', 'closed')
    RECORD_POLICY_LEVELS = ('open', 'closed', 'restricted')


    owners_cls = Owners