[elbe-devel] [PATCH 8/8] elbepack: db: remove admin flag on user
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Tue Aug 13 13:31:56 CEST 2024
The admin flag has no users anymore, remove it.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/commands/db.py | 4 +---
elbepack/db.py | 11 ++++-------
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/elbepack/commands/db.py b/elbepack/commands/db.py
index 43d32be0cf21..9904ef6f4d4c 100644
--- a/elbepack/commands/db.py
+++ b/elbepack/commands/db.py
@@ -14,10 +14,8 @@ from elbepack.db import ElbeDB
@add_argument('--fullname', default='Admin')
@add_argument('--password', default='foo')
@add_argument('--email', default='root at localhost')
- at add_argument('--noadmin', dest='admin', default=True, action='store_false')
def _init(args):
- ElbeDB.init_db(args.name, args.fullname, args.password,
- args.email, args.admin)
+ ElbeDB.init_db(args.name, args.fullname, args.password, args.email)
def _list_projects(args):
diff --git a/elbepack/db.py b/elbepack/db.py
index a15507c93873..4df429f5ba8c 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -21,7 +21,6 @@ with warnings.catch_warnings():
from passlib.hash import pbkdf2_sha512
from sqlalchemy import (
- Boolean,
Column,
DateTime,
ForeignKey,
@@ -722,15 +721,14 @@ class ElbeDB:
'application/octet-stream',
'Pbuilder artifact')
- def add_user(self, name, fullname, password, email, admin):
+ def add_user(self, name, fullname, password, email):
pwhash = pbkdf2_sha512.hash(password)
u = User(name=name,
fullname=fullname,
pwhash=pwhash,
- email=email,
- admin=admin)
+ email=email)
with session_scope(self.session) as s:
if s.query(User).filter(User.name == name).count() > 0:
@@ -771,7 +769,7 @@ class ElbeDB:
return int(u.id)
@classmethod
- def init_db(cls, name, fullname, password, email, admin):
+ def init_db(cls, name, fullname, password, email):
if not os.path.exists(cls.db_path):
try:
@@ -783,7 +781,7 @@ class ElbeDB:
db = ElbeDB()
try:
- db.add_user(name, fullname, password, email, admin)
+ db.add_user(name, fullname, password, email)
except ElbeDBError as e:
print(str(e))
@@ -798,7 +796,6 @@ class User(Base):
fullname = Column(String)
pwhash = Column(String)
email = Column(String)
- admin = Column(Boolean)
projects = relationship('Project', backref='owner')
--
2.46.0
More information about the elbe-devel
mailing list