root / accounts / models.py @ 0492a5b5
History | View | Annotate | Download (1.3 kB)
1 | 9f54980a | Leonidas Poulopoulos | # -*- coding: utf-8 -*- vim:fileencoding=utf-8:
|
---|---|---|---|
2 | afe2813b | Leonidas Poulopoulos | # vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab
|
3 | afe2813b | Leonidas Poulopoulos | |
4 | 0492a5b5 | Leonidas Poulopoulos | # Copyright (C) 2010-2014 GRNET S.A.
|
5 | 0492a5b5 | Leonidas Poulopoulos | #
|
6 | 0492a5b5 | Leonidas Poulopoulos | # This program is free software: you can redistribute it and/or modify
|
7 | 0492a5b5 | Leonidas Poulopoulos | # it under the terms of the GNU General Public License as published by
|
8 | 0492a5b5 | Leonidas Poulopoulos | # the Free Software Foundation, either version 3 of the License, or
|
9 | 0492a5b5 | Leonidas Poulopoulos | # (at your option) any later version.
|
10 | 0492a5b5 | Leonidas Poulopoulos | #
|
11 | 0492a5b5 | Leonidas Poulopoulos | # This program is distributed in the hope that it will be useful,
|
12 | 0492a5b5 | Leonidas Poulopoulos | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 0492a5b5 | Leonidas Poulopoulos | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | 0492a5b5 | Leonidas Poulopoulos | # GNU General Public License for more details.
|
15 | 0492a5b5 | Leonidas Poulopoulos | #
|
16 | 0492a5b5 | Leonidas Poulopoulos | # You should have received a copy of the GNU General Public License
|
17 | 0492a5b5 | Leonidas Poulopoulos | # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18 | 0492a5b5 | Leonidas Poulopoulos | #
|
19 | 9f54980a | Leonidas Poulopoulos | |
20 | e9d46ce1 | Leonidas Poulopoulos | from django.db import models |
21 | e9d46ce1 | Leonidas Poulopoulos | from django.contrib.auth.models import User |
22 | afe2813b | Leonidas Poulopoulos | from peers.models import * |
23 | e9d46ce1 | Leonidas Poulopoulos | |
24 | e9d46ce1 | Leonidas Poulopoulos | |
25 | e9d46ce1 | Leonidas Poulopoulos | class UserProfile(models.Model): |
26 | e9d46ce1 | Leonidas Poulopoulos | user = models.OneToOneField(User) |
27 | 6ee21ffd | Leonidas Poulopoulos | peer = models.ForeignKey(Peer) |
28 | 049a5a10 | Leonidas Poulopoulos | |
29 | c491c6f8 | Leonidas Poulopoulos | class Meta: |
30 | c491c6f8 | Leonidas Poulopoulos | permissions = ( |
31 | c491c6f8 | Leonidas Poulopoulos | ("overview", "Can see registered users and rules"), |
32 | c491c6f8 | Leonidas Poulopoulos | ) |
33 | c491c6f8 | Leonidas Poulopoulos | |
34 | c491c6f8 | Leonidas Poulopoulos | |
35 | 049a5a10 | Leonidas Poulopoulos | def __unicode__(self): |
36 | 049a5a10 | Leonidas Poulopoulos | return "%s:%s" %(self.user.username, self.peer.peer_name) |
37 | e9d46ce1 | Leonidas Poulopoulos | |
38 | e9d46ce1 | Leonidas Poulopoulos | def get_address_space(self): |
39 | e9d46ce1 | Leonidas Poulopoulos | networks = self.domain.networks.all()
|
40 | e9d46ce1 | Leonidas Poulopoulos | if not networks: |
41 | e9d46ce1 | Leonidas Poulopoulos | return False |
42 | e9d46ce1 | Leonidas Poulopoulos | return networks |