summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-gui/ipagui/controllers.py
blob: cd47da2fed0862d29f123407b4bff37f5fd0399f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
import random
from pickle import dumps, loads
from base64 import b64encode, b64decode

import os
import cherrypy
import turbogears
from turbogears import controllers, expose, flash
from turbogears import validators, validate
from turbogears import widgets, paginate
from turbogears import error_handler
from turbogears import identity
# from model import *
# import logging
# log = logging.getLogger("ipagui.controllers")

import ipa.config
import ipa.ipaclient
import ipa.user
from ipa.entity import utf8_encode_values
import xmlrpclib
import forms.user
import forms.group
from helpers import userhelper
from ipa import ipaerror

ipa.config.init_config()
user_new_form = forms.user.UserNewForm()
user_edit_form = forms.user.UserEditForm()
group_new_form = forms.group.GroupNewForm()
group_edit_form = forms.group.GroupEditForm()

password_chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

client = ipa.ipaclient.IPAClient(True)

user_fields = ['*', 'nsAccountLock']

group_fields = ['*']

def restrict_post():
    if cherrypy.request.method != "POST":
        turbogears.flash("This method only accepts posts")
        raise turbogears.redirect("/")

def utf8_encode(value):
    if value != None:
        value = value.encode('utf-8')
    return value


class Root(controllers.RootController):

    @expose(template="ipagui.templates.welcome")
    @identity.require(identity.not_anonymous())
    def index(self):
        return dict()

    @expose()
    @identity.require(identity.not_anonymous())
    def topsearch(self, **kw):
        if kw.get('searchtype') == "Users":
            return self.userlist(uid=kw.get('searchvalue'))
        else:
            return self.grouplist(criteria=kw.get('searchvalue'))



    ########
    # User #
    ########

    @expose("ipagui.templates.usernew")
    @identity.require(identity.not_anonymous())
    def usernew(self, tg_errors=None):
        """Displays the new user form"""
        if tg_errors:
            turbogears.flash("There was a problem with the form!")

        return dict(form=user_new_form)

    @expose()
    @identity.require(identity.not_anonymous())
    def usercreate(self, **kw):
        """Creates a new user"""
        restrict_post()
        client.set_krbccache(os.environ["KRB5CCNAME"])
        if kw.get('submit') == 'Cancel':
            turbogears.flash("Add user cancelled")
            raise turbogears.redirect('/userlist')

        tg_errors, kw = self.usercreatevalidate(**kw)
        if tg_errors:
            return dict(form=user_new_form, tg_template='ipagui.templates.usernew')

        try:
            new_user = ipa.user.User()
            new_user.setValue('uid', kw.get('uid'))
            new_user.setValue('givenname', kw.get('givenname'))
            new_user.setValue('sn', kw.get('sn'))
            new_user.setValue('mail', kw.get('mail'))
            new_user.setValue('telephonenumber', kw.get('telephonenumber'))
            if kw.get('nsAccountLock'):
                new_user.setValue('nsAccountLock', 'true')

            rv = client.add_user(new_user)
            turbogears.flash("%s added!" % kw['uid'])
            raise turbogears.redirect('/usershow', uid=kw['uid'])
        except ipaerror.exception_for(ipaerror.LDAP_DUPLICATE):
            turbogears.flash("Person with login '%s' already exists" %
                    kw.get('uid'))
            return dict(form=user_new_form, tg_template='ipagui.templates.usernew')
        except ipaerror.IPAError, e:
            turbogears.flash("User add failed: " + str(e))
            return dict(form=user_new_form, tg_template='ipagui.templates.usernew')


    @expose("ipagui.templates.useredit")
    @identity.require(identity.not_anonymous())
    def useredit(self, uid, tg_errors=None):
        """Displays the edit user form"""
        if tg_errors:
            turbogears.flash("There was a problem with the form!")

        try:
            client.set_krbccache(os.environ["KRB5CCNAME"])
            user = client.get_user_by_uid(uid, user_fields)
            user_dict = user.toDict()
            # Edit shouldn't fill in the password field.
            if user_dict.has_key('userpassword'):
                del(user_dict['userpassword'])

            # store a copy of the original user for the update later
            user_data = b64encode(dumps(user_dict))
            user_dict['user_orig'] = user_data
            return dict(form=user_edit_form, user=user_dict)
        except ipaerror.IPAError, e:
            turbogears.flash("User edit failed: " + str(e))
            raise turbogears.redirect('/usershow', uid=kw.get('uid'))

    @expose()
    @identity.require(identity.not_anonymous())
    def userupdate(self, **kw):
        """Updates an existing user"""
        restrict_post()
        client.set_krbccache(os.environ["KRB5CCNAME"])
        if kw.get('submit') == 'Cancel Edit':
            turbogears.flash("Edit user cancelled")
            raise turbogears.redirect('/usershow', uid=kw.get('uid'))

        tg_errors, kw = self.userupdatevalidate(**kw)
        if tg_errors:
            return dict(form=user_edit_form, user=kw,
                        tg_template='ipagui.templates.useredit')

        password_change = False
        try:
            orig_user_dict = loads(b64decode(kw.get('user_orig')))

            new_user = ipa.user.User(orig_user_dict)
            new_user.setValue('givenname', kw.get('givenname'))
            new_user.setValue('sn', kw.get('sn'))
            new_user.setValue('mail', kw.get('mail'))
            new_user.setValue('telephonenumber', kw.get('telephonenumber'))
            if kw.get('nsAccountLock'):
                new_user.setValue('nsAccountLock', 'true')
            else:
                new_user.setValue('nsAccountLock', None)
            if kw.get('editprotected') == 'true':
                if kw.get('userpassword'):
                    password_change = True
                new_user.setValue('uidnumber', str(kw.get('uidnumber')))
                new_user.setValue('gidnumber', str(kw.get('gidnumber')))

            #
            # this is a hack until we decide on the policy for names/cn/sn/givenName
            #
            new_user.setValue('cn',
                           "%s %s" % (new_user.getValue('givenname'),
                                      new_user.getValue('sn')))

            rv = client.update_user(new_user)
        except ipaerror.exception_for(ipaerror.LDAP_EMPTY_MODLIST), e:
            if not password_change:
                turbogears.flash("User update failed: " + str(e))
                return dict(form=user_edit_form, user=kw,
                            tg_template='ipagui.templates.useredit')
        except ipaerror.IPAError, e:
            turbogears.flash("User update failed: " + str(e))
            return dict(form=user_edit_form, user=kw,
                        tg_template='ipagui.templates.useredit')

        try:
            if password_change:
                rv = client.modifyPassword(kw['uid'], "", kw.get('userpassword'))
        except ipaerror.IPAError, e:
            turbogears.flash("User password change failed: " + str(e))
            return dict(form=user_edit_form, user=kw,
                        tg_template='ipagui.templates.useredit')

        turbogears.flash("%s updated!" % kw['uid'])
        raise turbogears.redirect('/usershow', uid=kw['uid'])


    @expose("ipagui.templates.userlist")
    @identity.require(identity.not_anonymous())
    def userlist(self, **kw):
        """Searches for users and displays list of results"""
        client.set_krbccache(os.environ["KRB5CCNAME"])
        users = None
        counter = 0
        uid = kw.get('uid')
        if uid != None and len(uid) > 0:
            try:
                users = client.find_users(uid.encode('utf-8'), None, 0, 2)
                counter = users[0]
                users = users[1:]
                if counter == -1:
                    turbogears.flash("These results are truncated.<br />" +
                                    "Please refine your search and try again.")
            except ipaerror.IPAError, e:
                turbogears.flash("User list failed: " + str(e))
                raise turbogears.redirect("/userlist")

        return dict(users=users, uid=uid, fields=forms.user.UserFields())

    @expose("ipagui.templates.userlistajax")
    @identity.require(identity.not_anonymous())
    def userlist_ajax(self, **kw):
        """Searches for users and displays list of results in a table.
           This method is used for ajax calls."""
        client.set_krbccache(os.environ["KRB5CCNAME"])
        users = []
        searchlimit = 100
        uid = kw.get('uid')
        if uid != None and len(uid) > 0:
            try:
                users = client.find_users(uid.encode('utf-8'), None, searchlimit)
                counter = users[0]
                users = users[1:]
            except ipaerror.IPAError, e:
                turbogears.flash("User list failed: " + str(e))

        return dict(users=users, uid=uid, fields=forms.user.UserFields(),
                counter=counter)


    @expose("ipagui.templates.usershow")
    @identity.require(identity.not_anonymous())
    def usershow(self, uid):
        """Retrieve a single user for display"""
        client.set_krbccache(os.environ["KRB5CCNAME"])
        try:
            user = client.get_user_by_uid(uid, user_fields)
            user_groups = client.get_groups_by_member(user.dn, ['cn'])
            user_reports = client.get_users_by_manager(user.dn,
                    ['givenname', 'sn', 'uid'])

            user_manager = None
            try:
                if user.manager:
                    user_manager = client.get_user_by_dn(user.manager,
                        ['givenname', 'sn', 'uid'])
            except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
                pass

            return dict(user=user.toDict(), fields=forms.user.UserFields(),
                        user_groups=user_groups, user_reports=user_reports,
                        user_manager=user_manager)
        except ipaerror.IPAError, e:
            turbogears.flash("User show failed: " + str(e))
            raise turbogears.redirect("/")

    @validate(form=user_new_form)
    @identity.require(identity.not_anonymous())
    def usercreatevalidate(self, tg_errors=None, **kw):
        return tg_errors, kw

    @validate(form=user_edit_form)
    @identity.require(identity.not_anonymous())
    def userupdatevalidate(self, tg_errors=None, **kw):
        return tg_errors, kw

    @expose()
    def userindex(self):
        raise turbogears.redirect("/userlist")

    # @expose()
    def generate_password(self):
        password = ""
        generator = random.SystemRandom()
        for char in range(8):
            index = generator.randint(0, len(password_chars) - 1)
            password += password_chars[index]

        return password

    @expose()
    @identity.require(identity.not_anonymous())
    def suggest_uid(self, givenname, sn):
        if (len(givenname) == 0) or (len(sn) == 0):
            return ""

        client.set_krbccache(os.environ["KRB5CCNAME"])
        givenname = givenname.lower()
        sn = sn.lower()

        uid = givenname[0] + sn[:7]
        try:
            client.get_user_by_uid(uid)
        except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
            return uid

        uid = givenname[:7] + sn[0]
        try:
            client.get_user_by_uid(uid)
        except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
            return uid

        uid = (givenname + sn)[:8]
        try:
            client.get_user_by_uid(uid)
        except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
            return uid

        uid = sn[:8]
        try:
            client.get_user_by_uid(uid)
        except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
            return uid

        suffix = 2
        template = givenname[0] + sn[:7]
        while suffix < 20:
            uid = template[:8 - len(str(suffix))] + str(suffix)
            try:
                client.get_user_by_uid(uid)
            except ipaerror.exception_for(ipaerror.LDAP_NOT_FOUND):
                return uid
            suffix += 1

        return ""

    @expose()
    @identity.require(identity.not_anonymous())
    def suggest_email(self, givenname, sn):
        if (len(givenname) == 0) or (len(sn) == 0):
            return ""

        client.set_krbccache(os.environ["KRB5CCNAME"])
        givenname = givenname.lower()
        sn = sn.lower()

        # TODO - get from config
        domain = "freeipa.org"

        return "%s.%s@%s" % (givenname, sn, domain)


        # TODO - mail is currently not indexed nor searchable.
        #        implement when it's done
        # email = givenname + "." + sn + domain
        # users = client.find_users(email, ['mail'])
        # if len(filter(lambda u: u['mail'] == email, users[1:])) == 0:
        #     return email

        # email = self.suggest_uid(givenname, sn) + domain
        # users = client.find_users(email, ['mail'])
        # if len(filter(lambda u: u['mail'] == email, users[1:])) == 0:
        #     return email

        # suffix = 2
        # template = givenname + "." + sn
        # while suffix < 20:
        #     email = template + str(suffix) + domain
        #     users = client.find_users(email, ['mail'])
        #     if len(filter(lambda u: u['mail'] == email, users[1:])) == 0:
        #         return email
        #     suffix += 1

        # return ""



    #########
    # Group #
    #########

    @expose("ipagui.templates.groupindex")
    @identity.require(identity.not_anonymous())
    def groupindex(self, tg_errors=None):
        client.set_krbccache(os.environ["KRB5CCNAME"])
        return dict()

    @expose("ipagui.templates.groupnew")
    @identity.require(identity.not_anonymous())
    def groupnew(self, tg_errors=None):
        """Displays the new group form"""
        if tg_errors:
            turbogears.flash("There was a problem with the form!")

        client.set_krbccache(os.environ["KRB5CCNAME"])

        return dict(form=group_new_form)

    @expose()
    @identity.require(identity.not_anonymous())
    def groupcreate(self, **kw):
        """Creates a new group"""
        restrict_post()
        client.set_krbccache(os.environ["KRB5CCNAME"])

        if kw.get('submit') == 'Cancel':
            turbogears.flash("Add group cancelled")
            raise turbogears.redirect('/')

        tg_errors, kw = self.groupcreatevalidate(**kw)
        if tg_errors:
            return dict(form=group_new_form, tg_template='ipagui.templates.groupnew')

        try:
            new_group = ipa.group.Group()
            new_group.setValue('cn', kw.get('cn'))
            new_group.setValue('description', kw.get('description'))

            rv = client.add_group(new_group)
            turbogears.flash("%s added!" % kw.get('cn'))
            raise turbogears.redirect('/groupshow', cn=kw.get('cn'))
        except ipaerror.exception_for(ipaerror.LDAP_DUPLICATE):
            turbogears.flash("Group with name '%s' already exists" %
                    kw.get('cn'))
            return dict(form=group_new_form, tg_template='ipagui.templates.groupnew')
        except ipaerror.IPAError, e:
            turbogears.flash("Group add failed: " + str(e) + "<br/>" + str(e.detail))
            return dict(form=group_new_form, tg_template='ipagui.templates.groupnew')


    @expose("ipagui.templates.groupedit")
    @identity.require(identity.not_anonymous())
    def groupedit(self, cn, tg_errors=None):
        """Displays the edit group form"""
        if tg_errors:
            turbogears.flash("There was a problem with the form!")

        client.set_krbccache(os.environ["KRB5CCNAME"])
        try:
            group = client.get_group_by_cn(cn, group_fields)

            group_dict = group.toDict()

            #
            # convert members to users, for easier manipulation on the page
            #
            member_dns = []
            if group_dict.has_key('uniquemember'):
                member_dns = group_dict.get('uniquemember')
                # remove from dict - it's not needed for update
                # and we are storing the members in a different form
                del group_dict['uniquemember']
            if not(isinstance(member_dns,list) or isinstance(member_dns,tuple)):
                member_dns = [member_dns]

            # TODO: convert this into an efficient (single) function call
            member_users = map(
                    lambda dn: client.get_user_by_dn(dn, ['givenname', 'sn', 'uid']),
                    member_dns)

            # Map users into an array of dicts, which can be serialized
            # (so we don't have to do this on each round trip)
            member_dicts = map(lambda user: user.toDict(), member_users)

            # store a copy of the original group for the update later
            group_data = b64encode(dumps(group_dict))
            member_data = b64encode(dumps(member_dicts))
            group_dict['group_orig'] = group_data
            group_dict['member_data'] = member_data

            return dict(form=group_edit_form, group=group_dict, members=member_dicts)
        except ipaerror.IPAError, e:
            turbogears.flash("Group edit failed: " + str(e))
            raise turbogears.redirect('/groupshow', uid=kw.get('cn'))

    @expose()
    @identity.require(identity.not_anonymous())
    def groupupdate(self, **kw):
        """Updates an existing group"""
        restrict_post()
        client.set_krbccache(os.environ["KRB5CCNAME"])
        if kw.get('submit') == 'Cancel Edit':
            turbogears.flash("Edit group cancelled")
            raise turbogears.redirect('/groupshow', cn=kw.get('cn'))

        # Decode the member data, in case we need to round trip
        member_dicts = loads(b64decode(kw.get('member_data')))


        tg_errors, kw = self.groupupdatevalidate(**kw)
        if tg_errors:
            return dict(form=group_edit_form, group=kw, members=member_dicts,
                        tg_template='ipagui.templates.groupedit')

        group_modified = False

        #
        # Update group itself
        #
        try:
            orig_group_dict = loads(b64decode(kw.get('group_orig')))

            new_group = ipa.group.Group(orig_group_dict)
            if new_group.description != kw.get('description'):
                group_modified = True
                new_group.setValue('description', kw.get('description'))
            if kw.get('editprotected') == 'true':
                new_gid = str(kw.get('gidnumber'))
                if new_group.gidnumber != new_gid:
                    group_modified = True
                    new_group.setValue('gidnumber', new_gid)

            if group_modified:
                rv = client.update_group(new_group)
                #
                # If the group update succeeds, but below operations fail, we
                # need to make sure a subsequent submit doesn't try to update
                # the group again.
                #
                kw['group_orig'] = b64encode(dumps(new_group.toDict()))
        except ipaerror.IPAError, e:
            turbogears.flash("User update failed: " + str(e))
            return dict(form=group_edit_form, group=kw, members=member_dicts,
                        tg_template='ipagui.templates.groupedit')

        #
        # Add members
        #
        failed_adds = []
        try:
            dnadds = kw.get('dnadd')
            if dnadds != None:
                if not(isinstance(dnadds,list) or isinstance(dnadds,tuple)):
                    dnadds = [dnadds]
                failed_adds = client.add_members_to_group(
                        utf8_encode_values(dnadds), kw.get('cn'))
                kw['dnadd'] = failed_adds
        except ipaerror.IPAError, e:
            turbogears.flash("User update failed: " + str(e))
            return dict(form=group_edit_form, group=kw, members=member_dicts,
                        tg_template='ipagui.templates.groupedit')

        #
        # Remove members
        #
        failed_dels = []
        try:
            dndels = kw.get('dndel')
            if dndels != None:
                if not(isinstance(dndels,list) or isinstance(dndels,tuple)):
                    dndels = [dndels]
                failed_dels = client.remove_members_from_group(
                        utf8_encode_values(dndels), kw.get('cn'))
                kw['dndel'] = failed_dels
        except ipaerror.IPAError, e:
            turbogears.flash("User update failed: " + str(e))
            return dict(form=group_edit_form, group=kw, members=member_dicts,
                        tg_template='ipagui.templates.groupedit')

        #
        # TODO - check failed ops to see if it's because of another update.
        #        handle "someone else already did it" errors better - perhaps
        #        not even as an error
        # TODO - update the Group Members list.
        #        (note that we have to handle the above todo first, or else
        #         there will be an error message, but the add/del lists will
        #         be empty)
        #
        if (len(failed_adds) > 0) or (len(failed_dels) > 0):
            message = "There was an error updating group members.<br />"
            message += "Failures have been preserved in the add/remove lists."
            if group_modified:
                message = "Group Details successfully updated.<br />" + message
            turbogears.flash(message)
            return dict(form=group_edit_form, group=kw, members=member_dicts,
                        tg_template='ipagui.templates.groupedit')

        turbogears.flash("%s updated!" % kw['cn'])
        raise turbogears.redirect('/groupshow', cn=kw['cn'])


    @expose("ipagui.templates.grouplist")
    @identity.require(identity.not_anonymous())
    def grouplist(self, **kw):
        """Search for groups and display results"""
        client.set_krbccache(os.environ["KRB5CCNAME"])
        groups = None
        # counter = 0
        criteria = kw.get('criteria')
        if criteria != None and len(criteria) > 0:
            try:
                groups = client.find_groups(criteria.encode('utf-8'), None, 0, 2)
                counter = groups[0]
                groups = groups[1:]
                if counter == -1:
                    turbogears.flash("These results are truncated.<br />" +
                                    "Please refine your search and try again.")
            except ipaerror.IPAError, e:
                turbogears.flash("Find groups failed: " + str(e))
                raise turbogears.redirect("/grouplist")

        return dict(groups=groups, criteria=criteria, fields=forms.group.GroupFields())

    @expose("ipagui.templates.groupshow")
    @identity.require(identity.not_anonymous())
    def groupshow(self, cn):
        """Retrieve a single group for display"""
        client.set_krbccache(os.environ["KRB5CCNAME"])
        try:
            group = client.get_group_by_cn(cn, group_fields)
            group_dict = group.toDict()

            #
            # convert members to users, for display on the page
            #
            member_dns = []
            if group_dict.has_key('uniquemember'):
                member_dns = group_dict.get('uniquemember')
            if not(isinstance(member_dns,list) or isinstance(member_dns,tuple)):
                member_dns = [member_dns]

            # TODO: convert this into an efficient (single) function call
            member_users = map(
                    lambda dn: client.get_user_by_dn(dn, ['givenname', 'sn', 'uid']),
                    member_dns)
            member_dicts = map(lambda user: user.toDict(), member_users)

            return dict(group=group_dict, fields=forms.group.GroupFields(),
                    members = member_dicts)
        except ipaerror.IPAError, e:
            turbogears.flash("Group show failed: " + str(e))
            raise turbogears.redirect("/")

    @validate(form=group_new_form)
    @identity.require(identity.not_anonymous())
    def groupcreatevalidate(self, tg_errors=None, **kw):
        return tg_errors, kw

    @validate(form=group_edit_form)
    @identity.require(identity.not_anonymous())
    def groupupdatevalidate(self, tg_errors=None, **kw):
        return tg_errors, kw

    @expose("ipagui.templates.loginfailed")
    def loginfailed(self, **kw):
        return dict()