diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2013-08-30 23:21:42 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2013-08-30 23:30:52 +0200 |
commit | 143f638a4b1bafdc4a2a811a9f4c97a5392a0acc (patch) | |
tree | a3f5e445ef7c597c25890b57b1b224504746405d /db.py | |
parent | 3c42d5d76da5eda2ce6bedd954269161259b2289 (diff) |
Added settings for registrations and uploads.
* create_active_users:
Controls whether new user accounts are created as 'active'; accounts
that are not marked as active will not be able to log in, and will be
automatically logged out if they're already logged in.
* allow_registration:
Allow or disallow creation of new user accounts. Any attempts to
access the registration page will result in an error message.
* allow_anonymous_uploads:
Allow or disallow uploading of files by anonymous (not logged in)
users. Combined with either allow_registration or create_active_users,
this will effectively create a private filebin where the admin must
explicitly create or activate new users.
Diffstat (limited to 'db.py')
-rw-r--r-- | db.py | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,4 +1,4 @@ -from sqlalchemy import create_engine, Column, Integer, String, DateTime, Text, Index, ForeignKey +from sqlalchemy import create_engine, Column, Integer, String, DateTime, Text, Index, ForeignKey, Boolean from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, relation, backref from sqlalchemy.orm.exc import NoResultFound @@ -16,11 +16,14 @@ class User(Base): id = Column(Integer, primary_key = True) username = Column(String, unique = True, index = True) password = Column(String) + last_login = Column(DateTime) + active = Column(Boolean, nullable = False) files = relation('File', backref = 'user', order_by = 'File.date.desc()') - def __init__(self, username, password): + def __init__(self, username, password, active): self.username = username self.password = password + self.active = active class File(Base): __tablename__ = 'files' |