42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
import geruecht.controller.databaseController as dc
|
|
from geruecht.logger import getDebugLogger
|
|
|
|
db = dc.DatabaseController()
|
|
debug = getDebugLogger()
|
|
|
|
class Base:
|
|
def updateWorkgroupsOfUser(self, user, workgroups):
|
|
debug.info("update workgroups {{ {} }} of user {{ {} }}".format(workgroups, user))
|
|
db.deleteWorkgroupsOfUser(user)
|
|
for workgroup in workgroups:
|
|
db.setUserWorkgroup(user, workgroup)
|
|
return db.getWorkgroupsOfUser(user['id'])
|
|
|
|
def getAllWorkgroups(self):
|
|
debug.info("get all workgroups")
|
|
retVal = db.getAllWorkgroups()
|
|
debug.debug("workgroups are {{ {} }}".format(retVal))
|
|
return retVal
|
|
|
|
def getWorkgroups(self, name):
|
|
debug.info("get Workgroup {{ {} }}".format(name))
|
|
retVal = db.getWorkgroup(name)
|
|
debug.debug("workgroup is {{ {} }} is {{ {} }}".format(name, retVal))
|
|
return retVal
|
|
|
|
def setWorkgroup(self, name, boss):
|
|
debug.info("set workgroup {{ {} }} with boss {{ {} }}".format(name, boss))
|
|
retVal = db.setWorkgroup(name, boss)
|
|
debug.debug(
|
|
"seted workgroup {{ {} }} is {{ {} }}".format(name, retVal))
|
|
return retVal
|
|
|
|
def deleteWorkgroup(self, workgroup):
|
|
debug.info("delete workgroup {{ {} }}".format(workgroup))
|
|
db.deleteWorkgroup(workgroup)
|
|
|
|
def updateWorkgroup(self, workgroup):
|
|
debug.info("update workgroup {{ {} }}".format(workgroup))
|
|
retVal = db.updateWorkgroup(workgroup)
|
|
debug.debug("updated workgroup is {{ {} }}".format(retVal))
|
|
return retVal |