Example #1
0
from django.db import models
from django.utils.translation import ugettext_lazy as _

from account.models import User
from .fields import PublicKeyField
from django.conf import settings

from llab.utils.enumeration import make_bitwise_enumeration, BitwiseSet
from llab.utils.request import notify_users


Notification = make_bitwise_enumeration(
    'Notification', (('email', 'Receive email notifications'),
                     ('web', 'Receive web notifications')))


# This is the key manager--or the gate-keeper
module = settings.SSH_KEY_MANAGEMENT_BACKEND
ssh_manager = __import__(module, globals(), locals(), ['run', 'delete'], -1)


class Profile(models.Model):
    user = models.OneToOneField(User)
    name = models.CharField(max_length=255, blank=True)
    url = models.URLField(blank=True)
    company = models.CharField(max_length=255, blank=True)
    location = models.CharField(max_length=255, blank=True)
    gravatar = models.EmailField(blank=True)
    _participating = models.IntegerField()
    _watching = models.IntegerField()
Example #2
0
from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse

from llab.utils.enumeration import make_bitwise_enumeration, BitwiseSet

Permission = make_bitwise_enumeration(
    'Permission', (('download_code', 'Download code'),
                   ('fork_project', 'Fork projects'),
                   ('commit', 'Commit to projects'),
                   ('read_project', 'View projects'),
                   ('read_wiki', 'Read Wikis belonging'),
                   ('read_issue', 'View issues'),
                   ('read_milestone', 'View milestones'),
                   ('read_project_snippet', 'View project snippets'),
                   ('read_team_member', 'View team members'),
                   ('read_merge_request', 'View merge requests'),
                   ('read_note', 'Read project notes'),
                   ('write_issue', 'Create issues'),
                   ('write_not', 'Placeholder'),
                   ('add_project', 'Create projects'),
                   ('delete_project', 'Delete projects'),
                   ('add_member', 'Add members'),
                   ('remove_member', 'Remove members')))


class Group(models.Model):
    name = models.CharField(max_length=255, db_index=True)
    organization = models.ForeignKey('Organization', related_name='groups')
    _permissions = models.IntegerField()