How to use the mongoengine.BooleanField function in mongoengine

To help you get started, we’ve selected a few mongoengine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github crits / crits / crits / signatures / signature.py View on Github external
version = IntField()

class SignatureAccess(EmbeddedDocument, CritsDocumentFormatter, CommonAccess):
    """
    ACL for Signatures.
    """

    upload_new_version = BooleanField(default=False)

    data_type_read = BooleanField(default=False)
    data_type_edit = BooleanField(default=False)

    data_type_min_version_read = BooleanField(default=False)
    data_type_min_version_edit = BooleanField(default=False)

    data_type_max_version_read = BooleanField(default=False)
    data_type_max_version_edit = BooleanField(default=False)

    data_read = BooleanField(default=False)
    data_edit = BooleanField(default=False)

    dependencies_read = BooleanField(default=False)
    dependencies_edit = BooleanField(default=False)
github crits / crits / crits / core / role.py View on Github external
control_panel_system_services_edit = BooleanField(default=False)
    control_panel_logging_read = BooleanField(default=False)
    control_panel_logging_edit = BooleanField(default=False)
    control_panel_items_read = BooleanField(default=False)
    control_panel_users_read = BooleanField(default=False)
    control_panel_users_add = BooleanField(default=False)
    control_panel_users_edit = BooleanField(default=False)
    control_panel_users_active = BooleanField(default=False)
    control_panel_roles_read = BooleanField(default=False)
    control_panel_roles_edit = BooleanField(default=False)
    control_panel_services_read = BooleanField(default=False)
    control_panel_services_edit = BooleanField(default=False)
    control_panel_audit_log_read = BooleanField(default=False)

    # Recent Activity
    recent_activity_read = BooleanField(default=False)

    # Structured Exchange Formats
    stix_import_add = BooleanField(default=False)

    # Timelines
    dns_timeline_read = BooleanField(default=False)
    emails_timeline_read = BooleanField(default=False)
    indicators_timeline_read = BooleanField(default=False)


    def migrate(self):
        """
        Migrate to the latest schema version.
        """

        pass
github crits / crits / crits / indicators / indicator.py View on Github external
type_edit = BooleanField(default=False)
    threat_type_edit = BooleanField(default=False)
    attack_type_edit = BooleanField(default=False)
    confidence_edit = BooleanField(default=False)
    impact_edit = BooleanField(default=False)

    actions_read = BooleanField(default=False)
    actions_add = BooleanField(default=False)
    actions_edit = BooleanField(default=False)
    actions_delete = BooleanField(default=False)

    activity_read = BooleanField(default=False)
    activity_add = BooleanField(default=False)
    activity_edit = BooleanField(default=False)
    activity_delete = BooleanField(default=False)
github wietze / bsides-ldn-2019 / app / engine / objects.py View on Github external
master_list = StringField()


class TechniqueMapping(EmbeddedDocument):
    tactic = ReferenceField(AttackTactic)
    technique = ReferenceField(AttackTechnique)


class Setting(ExtrovirtsDocument):
    last_attack_update = DateTimeField()
    last_psexec_update = DateTimeField()
    footprint = BooleanField()
    recursion_limit = IntField()
    obfuscate = BooleanField()
    planner_depth = IntField()
    external_tools = BooleanField()
github StackStorm / st2 / st2common / st2common / models / db / rbac.py View on Github external
user: A reference to the user name to which the role is assigned.
        role: A reference to the role name which is assigned to the user.
        source: Source where this assignment comes from. Path to a file for local assignments
                and "API" for API assignments.
        description: Optional assigment description.
    """

    user = me.StringField(required=True)
    role = me.StringField(required=True, unique_with=['user', 'source'])
    source = me.StringField(required=True, unique_with=['user', 'role'])
    description = me.StringField()
    # True if this is assigned created on authentication based on the remote groups provided by
    # the auth backends.
    # Remote assignments are special in a way that they are not manipulated with when running
    # st2-apply-rbac-auth-definitions tool.
    is_remote = me.BooleanField(default=False)

    meta = {
        'indexes': [
            {'fields': ['user']},
            {'fields': ['role']},
            {'fields': ['source']},
            {'fields': ['is_remote']},
            {'fields': ['user', 'role']},
        ]
    }


class PermissionGrantDB(stormbase.StormFoundationDB):
    """
    An entity which represents permission assignment.
github DurianStallSingapore / Zilliqa-Mining-Proxy / zilpool / database / ziladmin.py View on Github external
AdminActions = [
    "verify_miner_email",
    "verify_owner_email",
    "approve_nodes",
    "reject_nodes",
    "verify_pass_code",
]


class ZilAdminToken(ModelMixin, mg.Document):
    meta = {"collection": "zil_admin_token", "strict": False}

    token = mg.StringField(max_length=128)
    expire_time = mg.DateTimeField()
    finished = mg.BooleanField(default=False)

    action = mg.StringField(max_length=32)
    ext_data = mg.DictField()

    @classmethod
    def calc_hash(cls, ext_data):
        return hashlib.sha256(json.dumps(ext_data).encode()).hexdigest()[:8]

    def check_hash(self, data_hash):
        return self.calc_hash(self.ext_data) == data_hash

    @classmethod
    def create_token(cls, action, ext_data=None, expire_secs=24*60*60):
        assert action in AdminActions

        if ext_data is None:
github crits / crits / crits / signatures / signature.py View on Github external
class SignatureAccess(EmbeddedDocument, CritsDocumentFormatter, CommonAccess):
    """
    ACL for Signatures.
    """

    upload_new_version = BooleanField(default=False)

    data_type_read = BooleanField(default=False)
    data_type_edit = BooleanField(default=False)

    data_type_min_version_read = BooleanField(default=False)
    data_type_min_version_edit = BooleanField(default=False)

    data_type_max_version_read = BooleanField(default=False)
    data_type_max_version_edit = BooleanField(default=False)

    data_read = BooleanField(default=False)
    data_edit = BooleanField(default=False)

    dependencies_read = BooleanField(default=False)
    dependencies_edit = BooleanField(default=False)
github dchaplinsky / unshred-tag / models / shreds.py View on Github external
if self._synonyms_cache is None:
            mapping = {}
            for t in self.filter(synonyms__exists=True):
                for s in t["synonyms"]:
                    mapping[s] = t["title"]
            self.__class__._synonyms_cache = mapping
        return self._synonyms_cache


class Tags(Document):
    title = StringField(max_length=200, default='', primary_key=True)
    description = StringField(max_length=200, default='')
    usages = IntField(default=0)
    shreds = ListField(ReferenceField(Cluster))
    synonyms = ListField(StringField(max_length=200))
    is_base = BooleanField(default=True)
    category = StringField(max_length=200, default='')
    created_by = ReferenceField(User, reverse_delete_rule=CASCADE)
    created_at = DateTimeField(default=datetime.datetime.now)
    hotkey = StringField(max_length=10, default='')

    meta = {'queryset_class': TagsQS}

    def __unicode__(self):
        return self.title


class Pages(Document):
    name = StringField(max_length=200)
    created_by = ReferenceField(User, reverse_delete_rule=CASCADE)
    shreds = ListField(ReferenceField(Cluster))
    created = DateTimeField(default=datetime.datetime.now)
github crits / crits / crits / core / crits_mongoengine.py View on Github external
write = BooleanField(default=False)
    delete = BooleanField(default=False)
    download = BooleanField(default=False)

    description_read = BooleanField(default=False)
    description_edit = BooleanField(default=False)

    #Actions List
    actions_read = BooleanField(default=False)
    actions_add = BooleanField(default=False)
    actions_edit = BooleanField(default=False)
    actions_delete = BooleanField(default=False)

    # Bucket List
    bucketlist_read = BooleanField(default=False)
    bucketlist_edit = BooleanField(default=False)

    # Campaigns
    campaigns_read = BooleanField(default=False)
    campaigns_add = BooleanField(default=False)
    campaigns_edit = BooleanField(default=False)
    campaigns_delete = BooleanField(default=False)

    # Comments
    comments_read = BooleanField(default=False)
    comments_add = BooleanField(default=False)
    comments_edit = BooleanField(default=False)
    comments_delete = BooleanField(default=False)

    # Locations
    locations_read = BooleanField(default=False)
    locations_add = BooleanField(default=False)
github samuelclay / NewsBlur / apps / social / models.py View on Github external
twitter_username      = mongo.StringField()
    twitter_refresh_date  = mongo.DateTimeField()
    facebook_uid          = mongo.StringField()
    facebook_access_token = mongo.StringField()
    facebook_friend_ids   = mongo.ListField(mongo.StringField())
    facebook_picture_url  = mongo.StringField()
    facebook_refresh_date = mongo.DateTimeField()
    appdotnet_uid         = mongo.StringField()
    appdotnet_access_token= mongo.StringField()
    appdotnet_friend_ids  = mongo.ListField(mongo.StringField())
    appdotnet_picture_url = mongo.StringField()
    appdotnet_refresh_date= mongo.DateTimeField()
    upload_picture_url    = mongo.StringField()
    syncing_twitter       = mongo.BooleanField(default=False)
    syncing_facebook      = mongo.BooleanField(default=False)
    syncing_appdotnet     = mongo.BooleanField(default=False)
    
    meta = {
        'collection': 'social_services',
        'indexes': ['user_id', 'twitter_friend_ids', 'facebook_friend_ids', 'twitter_uid', 'facebook_uid', 'appdotnet_uid'],
        'allow_inheritance': False,
    }
    
    def __unicode__(self):
        user = User.objects.get(pk=self.user_id)
        return "%s (Twitter: %s, FB: %s, ADN: %s)" % (user.username, self.twitter_uid, self.facebook_uid, self.appdotnet_uid)
        
    def canonical(self):
        user = User.objects.get(pk=self.user_id)
        return {
            'twitter': {
                'twitter_username': self.twitter_username,