[gen] Users have now a workflow allowing them to deactivated. An inactive user can't log in anymore. This is useful if the User is tied to other objects and cannot be removed without braking the data model, but does not correspond anymore to an active user that is allowed to log in.

This commit is contained in:
Gaetan Delannay 2014-09-11 16:41:08 +02:00
parent 4fc74b36e7
commit 400158a0a1
5 changed files with 32 additions and 20 deletions

View file

@ -1,5 +1,6 @@
# ------------------------------------------------------------------------------
from appy.gen import WorkflowOwner
from appy.gen.layout import summaryPageLayouts
from appy.gen.wrappers import AbstractWrapper
from appy.gen import utils as gutils
@ -7,6 +8,7 @@ from appy.gen import utils as gutils
class UserWrapper(AbstractWrapper):
workflow = WorkflowOwner
specialUsers = ('system', 'anon', 'admin')
layouts = summaryPageLayouts
def showLogin(self):
'''When must we show the login field?'''

View file

@ -6,6 +6,7 @@ import os, os.path, mimetypes
import appy.pod
from appy.gen import Field, Search, Ref, String, WorkflowAnonymous
from appy.gen.indexer import defaultIndexes
from appy.gen.layout import defaultPageLayouts
from appy.gen.utils import createObject
from appy.px import Px
from appy.shared.utils import getOsTempFolder, executeCommand, \
@ -681,6 +682,14 @@ class AbstractWrapper(object):
if not res: res = WorkflowAnonymous
return res
@classmethod
def getPageLayouts(klass):
'''Returns the page layouts for p_klass.'''
res = klass._getParentAttr('layouts')
# Return the default page layout if no layout was found.
if not res: res = defaultPageLayouts
return res
@classmethod
def getIndexes(klass, includeDefaults=True):
'''Returns a dict whose keys are the names of the indexes that are