Skip to content

Commit

Permalink
Add network link to user
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Oct 22, 2015
1 parent 7d96930 commit 3c93326
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pritunl/user/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,3 +644,33 @@ def send_key_email(self, key_link_domain):
text_email,
html_email,
)

def add_network_link(self, network):
network = str(ipaddress.IPNetwork(network))

self.net_link_collection.update({
'user_id': self.id,
'org_id': self.org_id,
'network': network,
}, {
'user_id': self.id,
'org_id': self.org_id,
'network': network,
}, upsert=True)

def remove_network_link(self, network):
self.net_link_collection.remove({
'user_id': self.id,
'org_id': self.org_id,
'network': network,
})

def get_network_links(self):
links = []

for doc in self.net_link_collection.find({
'user_id': self.id,
}):
links.append(doc['network'])

return links

0 comments on commit 3c93326

Please sign in to comment.