Esempio n. 1
0
class chatbot_post(db.Model):
    id1 = db.Column(db.Integer, primary_key=True)
    question = db.Column(db.String)

    def __init__(self, id1, question):
        self.id1 = id1
        self.question = question
Esempio n. 2
0
class checklists_kb(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    question_ID = db.Column(db.Integer)
    question_ID = db.Column(db.Integer)
    include_always = db.Column(db.String)
    checklistID = db.Column(db.String)
    content = db.Column(db.String)
    kbID = db.Column(db.Integer, db.ForeignKey("kb_items.kbID"))
    kb_items = db.relationship("kb_items", foreign_keys=[kbID])

    question_ID = db.Column(db.Integer, db.ForeignKey("questions.id"))
    questions = db.relationship("questions", foreign_keys=[question_ID])

    checklist_type = db.Column(db.Integer)
    cwe = db.Column(db.Integer)

    def __init__(self, checklistID, content, kbID, checklist_type,
                 include_always, question_ID, cwe):
        self.question_ID = question_ID
        self.include_always = include_always
        self.checklistID = checklistID
        self.checklist_type = checklist_type
        self.content = content
        self.kbID = kbID
        self.cwe = cwe
Esempio n. 3
0
class Project(db.Model):

    __tablename__ = 'projects'

    id = db.Column(db.Integer, primary_key=True, unique=True, nullable=False)
    '''
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    user = db.relationship("User", foreign_keys=[user_id], backref=db.backref('projects'))

    owner_id = db.Column(db.Integer, db.ForeignKey('users.id'))
    owner = db.relationship("User", foreign_keys=[owner_id], backref=db.backref('owned_projects'))

    group_id = db.Column(db.Integer, db.ForeignKey('groups.id'), nullable=False)
    group = db.relationship("Group", backref=db.backref('projects', uselist=False))
    '''

    name = db.Column(db.Text, nullable=False)
    version = db.Column(db.Text, nullable=False)
    description = db.Column(db.Text, nullable=False)

    timestamp = db.Column(db.Text, nullable=False)

    def __init__(self, name, version, description, timestamp):
        self.name = name
        self.version = version
        self.description = description
        self.timestamp = timestamp
class checklist_types(db.Model):
    checklist_type = db.Column(db.Integer, primary_key=True)
    checklist_name = db.Column(db.Text)
    checklist_description = db.Column(db.Text)

    def __init__(self, checklist_name, checklist_description):
        self.checklist_name = checklist_name
        self.checklist_description = checklist_description
Esempio n. 5
0
class questions(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    question = db.Column(db.Text)
    checklist_type = db.Column(db.Integer)

    def __init__(self, question, checklist_type):
        self.question = question
        self.checklist_type = checklist_type
Esempio n. 6
0
class kb_items(db.Model):
    kbID = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.Text)
    content = db.Column(db.Text)

    def __init__(self, title, content):
        self.title = title
        self.content = content
Esempio n. 7
0
class ChatbotLog(db.Model):

    __tablename__ = 'chatbot_log'

    id = db.Column(db.Integer, primary_key=True)
    question = db.Column(db.Text)

    def __init__(self, question):
        self.question = question
Esempio n. 8
0
class LabItemCodeOptions(db.Model):
	
    __tablename__ = 'lab_items_code_options'

    id = db.Column(db.Integer, primary_key=True)
    vuln = db.Column(db.Text, nullable=False)

    def __init__(self, vuln):
        self.vuln = vuln
Esempio n. 9
0
class ChecklistKB(db.Model):
    
    __tablename__ = 'checklists_kb'
    
    id = db.Column(db.Integer, primary_key=True)

    checklist_id = db.Column(db.String(255), nullable=False)
    content = db.Column(db.Text)
    cwe = db.Column(db.Integer)
    maturity = db.Column(db.Integer, nullable=True)

    question_id = db.Column(db.Integer, db.ForeignKey('questions.id'), nullable=True)
    questions = db.relationship("Question", backref=db.backref('checklist_kb'))

    include_always = db.Column(db.Boolean)

    kb_id = db.Column(db.Integer, db.ForeignKey("kb_items.kb_id"), nullable=True)
    kb_items = db.relationship("KBItem", backref=db.backref('checklist_kb'))

    checklist_type = db.Column(db.Integer, nullable=False)

    def __init__(self, checklist_id, content, checklist_type, include_always, cwe, maturity):
        self.include_always = include_always
        self.checklist_id = checklist_id
        self.checklist_type = checklist_type
        self.content = content
        self.cwe = cwe 
        self.maturity = maturity 
Esempio n. 10
0
class question_pre_results(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    projectID = db.Column(db.Integer)
    question_pre_ID = db.Column(db.Integer)
    result = db.Column(db.Text)


    def __init__(self, projectID, question_pre_ID, result):
        self.projectID = projectID
        self.question_pre_ID = question_pre_ID
        self.result = result
Esempio n. 11
0
class Question(db.Model):

    __tablename__ = 'questions'

    id = db.Column(db.Integer, primary_key=True)
    question = db.Column(db.Text, nullable=False)
    checklist_type = db.Column(db.Integer, nullable=False)

    def __init__(self, question, checklist_type):
        self.question = question
        self.checklist_type = checklist_type
Esempio n. 12
0
class ChecklistCategory(db.Model):
    
    __tablename__ = 'checklist_category'
    
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), nullable=False)
    description = db.Column(db.Text)
   
    def __init__(self, name, description):
        self.name = name
        self.description = description
Esempio n. 13
0
class Privilege(db.Model):

    __tablename__ = 'privileges'

    id = db.Column(db.Integer, primary_key=True)
    privilege = db.Column(db.String(255), nullable=False)

    def __init__(self, privilege):
        self.privilege = privilege

    def __repr__(self):
        return self.privilege
Esempio n. 14
0
class KBItem(db.Model):

    __tablename__ = 'kb_items'

    kb_id = db.Column(db.Integer, primary_key=True, autoincrement=False)
    title = db.Column(db.Text)
    content = db.Column(db.Text)

    def __init__(self, title, content, kb_id):
        self.kb_id = kb_id
        self.title = title
        self.content = content
Esempio n. 15
0
class project_sprints(db.Model):
    sprintID = db.Column(db.Integer, primary_key=True)
    sprintName = db.Column(db.Text)
    sprintDesc = db.Column(db.Text)
    groupID = db.Column(db.Integer)
    projectID = db.Column(db.Integer)

    def __init__(self, sprintName, sprintDesc, groupID, projectID):
        self.sprintName = sprintName
        self.sprintDesc = sprintDesc
        self.groupID = groupID
        self.projectID = projectID
Esempio n. 16
0
class checklists(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    checklistID = db.Column(db.Text)
    content = db.Column(db.Text)
    level = db.Column(db.Integer)
    kbID = db.Column(db.Integer)

    def __init__(self, checklistID, content, level, kbId):
        self.checklistID = checklistID
        self.content = content
        self.level = level
        self.kbID = kbId
Esempio n. 17
0
class groupmembers(db.Model):
    memberID = db.Column(db.Integer, primary_key=True)
    userID = db.Column(db.Integer)
    groupID = db.Column(db.Integer)
    ownerID = db.Column(db.Integer)
    timestamp = db.Column(db.Text)

    def __init__(self, memberID, userID, groupID, ownerID, timestamp):
        self.memberID = memberID
        self.userID = userID
        self.groupID = groupID
        self.ownerID = ownerID
        self.timestamp = timestamp
Esempio n. 18
0
class ChecklistType(db.Model):
	
    __tablename__ = 'checklist_types'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False)
    description = db.Column(db.Text, nullable=False)
    visibility = db.Column(db.Boolean, nullable=False)

    def __init__(self, name, description, visibility):
        self.name = name
        self.description = description
        self.visibility = visibility
Esempio n. 19
0
class LabItemCode(db.Model):

    __tablename__ = 'lab_items_code'

    id = db.Column(db.Integer, primary_key=True)
    code_example = db.Column(db.Text, nullable=False)
    solution = db.Column(db.Integer, nullable=False)
    code_type = db.Column(db.Text, nullable=False)

    def __init__(self, code_example, solution, code_type):
        self.code_example = code_example
        self.solution = solution
        self.code_type = code_type
Esempio n. 20
0
class KBItem(db.Model):
	
    __tablename__ = 'kb_items'
    
    kb_id = db.Column(db.Integer, primary_key=True, autoincrement=False)
    title = db.Column(db.Text)
    content = db.Column(db.Text)
    checklist_category_id = db.Column(db.Integer, db.ForeignKey("checklist_category.id"), nullable=True)
    checklist_category = db.relationship("ChecklistCategory", backref=db.backref('kb_items'))

    def __init__(self, title, content, kb_id):
        self.kb_id = kb_id
        self.title = title
        self.content = content
Esempio n. 21
0
class User(db.Model):

    __tablename__ = 'users'

    id = db.Column(db.Integer, primary_key=True)

    privilege_id = db.Column(db.Integer, db.ForeignKey('privileges.id'), nullable=False)
    privilege = db.relationship("Privilege", backref=db.backref('users'))
    accessToken = db.Column(db.Integer, unique=True, nullable=False)
    username = db.Column(db.String(255), nullable=True, unique=True)
    password = db.Column(db.Text, nullable=True)
    access = db.Column(db.Boolean, nullable=False)
    activated = db.Column(db.Boolean, nullable=False)
    email = db.Column(db.String(255), nullable=False, unique=True)
    groups = db.relationship('Group', back_populates='members')
    #group = db.relationship('GroupMember', back_populates='member')


    def __init__(self, email, accessToken='', username='', password='', access=False, activated=False):
        self.accessToken = accessToken
        self.username = username
        self.password = password
        self.access = access
        self.activated = activated
        self.email = email

    def __repr__(self):
        return "<User> {}| {} activated:{} access:{} email:{}>)".format(
           self.id, self.username, self.activated, self.access, self.email)
Esempio n. 22
0
class LabItem(db.Model):
	
    __tablename__ = 'lab_items'

    id = db.Column(db.Integer, primary_key=True)

    title = db.Column(db.Text, nullable=False)
    link = db.Column(db.Text, nullable=False)
    level = db.Column(db.Integer, nullable=False)

    def __init__(self, title, link, level):
    	self.title = title
    	self.link = link
    	self.level = level
Esempio n. 23
0
class CodeItem(db.Model):

    __tablename__ = 'code_items'

    id = db.Column(db.Integer, primary_key=True)

    title = db.Column(db.Text, nullable=False)
    content = db.Column(db.Text, nullable=False)
    code_lang = db.Column(db.Text, nullable=False)

    def __init__(self, content, title, lang):
        self.content = content
        self.title = title
        self.code_lang = lang
Esempio n. 24
0
class Project(db.Model):

    __tablename__ = 'projects'

    id = db.Column(db.Integer, primary_key=True, unique=True, nullable=False)
    name = db.Column(db.Text, nullable=False)
    version = db.Column(db.Text, nullable=False)
    description = db.Column(db.Text, nullable=False)
    timestamp = db.Column(db.Text, nullable=False)

    def __init__(self, name, version, description, timestamp):
        self.name = name
        self.version = version
        self.description = description
        self.timestamp = timestamp
Esempio n. 25
0
class ChecklistType(db.Model):
	
    __tablename__ = 'checklist_types'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Text, nullable=False)
    description = db.Column(db.Text, nullable=False)
    visibility = db.Column(db.Boolean, nullable=False)
    checklist_category_id = db.Column(db.Integer, db.ForeignKey("checklist_category.id"), nullable=True)
    checklist_category = db.relationship("ChecklistCategory", backref=db.backref('checklist_types'))

    def __init__(self, name, description, visibility):
        self.name = name
        self.description = description
        self.visibility = visibility
Esempio n. 26
0
class Group(db.Model):

    __tablename__ = 'groups'

    id = db.Column(db.Integer, primary_key=True)

    owner_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    owner = db.relationship('User', backref=db.backref("owned_groups"), uselist=False)

    groupName = db.Column(db.String(255), nullable=False)
    members = db.relationship('User', secondary=GroupMember, back_populates='groups')
    timestamp = db.Column(db.Text)

    def __init__(self, groupName, timestamp):
    	self.groupName = groupName
    	self.timestamp = timestamp
Esempio n. 27
0
class Comment(db.Model):

    __tablename__ = "comments"

    id = db.Column(db.Integer, primary_key=True)
    sprint_id = db.Column(db.Integer,
                          db.ForeignKey('project_sprints.id'),
                          nullable=False)
    sprint = db.relationship('ProjectSprint', backref=db.backref('comments'))

    checklist_id = db.Column(db.Integer,
                             db.ForeignKey("checklists_kb.id"),
                             nullable=False)
    checklist = db.relationship('ChecklistKB', backref=db.backref('commments'))

    status = db.Column(db.Integer, nullable=False)
    comment = db.Column(db.Text)
    date = db.Column(db.Integer, nullable=False)

    user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    user = db.relationship("User", backref=db.backref("comments"))

    def __init__(self, status, comment, date):
        self.status = status
        self.comment = comment
        self.date = date
Esempio n. 28
0
class CodeItem(db.Model):

    __tablename__ = 'code_items'

    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.Text, nullable=False)
    content = db.Column(db.Text, nullable=False)
    code_lang = db.Column(db.Text, nullable=False)
    checklist_category_id = db.Column(db.Integer,
                                      db.ForeignKey("checklist_category.id"),
                                      nullable=True)
    checklist_category = db.relationship("ChecklistCategory",
                                         backref=db.backref('code_items'))

    def __init__(self, content, title, lang):
        self.content = content
        self.title = title
        self.code_lang = lang
Esempio n. 29
0
class ChecklistKBCodeItem(db.Model):

    __tablename__ = 'checklist_kb_code_item'

    id = db.Column(db.Integer, primary_key=True)
    checklist_kb_id = db.Column(db.Integer,
                                db.ForeignKey("checklists_kb.id"),
                                nullable=False)
    checklists_kb_items = db.relationship(
        "ChecklistKB", backref=db.backref('checklist_kb_code_item'))
    code_items_id = db.Column(db.Integer,
                              db.ForeignKey("code_items.id"),
                              nullable=False)
    code_items = db.relationship("CodeItem",
                                 backref=db.backref('checklist_kb_code_item'))

    def __init__(self, checklist_kb_id, code_items_id):
        self.checklist_kb_id = checklist_kb_id
        self.code_items_id = code_items_id
Esempio n. 30
0
class QuestionResult(db.Model):

    __tablename__ = 'question_results'

    id = db.Column(db.Integer, primary_key=True)
    project_id = db.Column(db.Integer, db.ForeignKey("projects.id"))
    project = db.relationship("Project",
                              backref=db.backref('question_results'))

    sprint_id = db.Column(db.Integer, db.ForeignKey("project_sprints.id"))
    sprint = db.relationship("ProjectSprint",
                             backref=db.backref('question_results'))

    question_id = db.Column(db.Integer, db.ForeignKey('questions.id'))
    question = db.relationship("Question",
                               backref=db.backref('question_result'),
                               uselist=False)

    result = db.Column(db.Text)
    checklist_type = db.Column(db.Integer)

    def __init__(self, result, checklist_type):

        self.result = result
        self.checklist_type = checklist_type