Open Kilda Java Documentation
models.py
Go to the documentation of this file.
1 # Copyright 2017 Telstra Open Source
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 
16 import sys, os
17 from app import application
18 from app import utils, db
19 
20 class Users(db.Model):
21  id = db.Column(db.BIGINT, primary_key=True)
22  username = db.Column(db.String(500))
23  password = db.Column(db.String(500))
24  twofactor = db.Column(db.String(500))
25 
26  def __init__(self , username ,password , twofactor):
27  self.username = username
28  self.password = password
29  self.twofactor = twofactor
30 
31  def is_authenticated(self):
32  return True
33 
34  def is_active(self):
35  return True
36 
37  def is_anonymous(self):
38  return False
39 
40  def get_id(self):
41  return unicode(self.username)
42 
43  def __repr__(self):
44  return '<User %r>' % (self.username)
45 
46 
47 '''
48 CREATE TABLE Users (
49  id integer PRIMARY KEY,
50  username CHAR(50) NOT NULL UNIQUE,
51  password CHAR(50) NOT NULL,
52  twofactor CHAR(50) NOT NULL
53 );
54 insert into Users values (1, 'admin', '285b1244f9c22381b2e2669b181ece10362673c873d17a6e34be86be03d01e62fa4d80b625b97c5ec110fc35c26a81d6618cce99e64352b807446258e4c64961','somejunk');
55 '''
def is_active(self)
Definition: models.py:34
def __repr__(self)
Definition: models.py:43
def __init__(self, username, password, twofactor)
Definition: models.py:26
def get_id(self)
Definition: models.py:40
def is_authenticated(self)
Definition: models.py:31
def is_anonymous(self)
Definition: models.py:37