[gen] A page can now be visible on edit but not on view (ie, the new User page containing only fields 'password' and 'retype password'. Default User class has now 2 pages: the 2 password fields are on a separate page. Zone containing user name in the user strip has evolved.

This commit is contained in:
Gaetan Delannay 2014-10-24 15:55:45 +02:00
parent c316ab896b
commit 412d9f939f
20 changed files with 150 additions and 106 deletions

View file

@ -17,6 +17,7 @@
import types, string
from group import Group
from appy.px import Px
from appy.gen.utils import User
from appy.gen.mail import sendNotification
# Default Appy permissions -----------------------------------------------------
@ -568,6 +569,11 @@ class WorkflowOwner:
active = State({r:(ma, o), w:(ma, o), d:ma}, initial=True)
inactive = State({r:(ma, o), w:ma, d:ma})
# Transitions
deactivate = Transition( (active, inactive), condition=ma)
def doDeactivate(self, obj):
'''Prevent user "admin" from being deactivated.'''
if isinstance(obj, User) and (obj.login == 'admin'):
raise Exception('Cannot deactivate admin.')
deactivate = Transition( (active, inactive), condition=ma,
action=doDeactivate)
reactivate = Transition( (inactive, active), condition=ma)
# ------------------------------------------------------------------------------