Home | Trees | Indices | Help |
|
---|
|
1 from zope.interface import implements 2 from webut.skin import iskin 3 from ldaptor.apps.webui import login, search, edit, add, delete, mass_change_password, change_password, move, iwebui 4 from ldaptor.protocols.ldap import distinguishedname 5 from ldaptor.apps.webui.uriquote import uriUnquote 6 from ldaptor import interfaces 7 from ldaptor.apps.webui.i18n import _ 8 from ldaptor.apps.webui import i18n 9 10 from nevow import rend, loaders, url, static, inevow 11 from formless import annotate, webform, iformless 12 import os 1315 implements(iskin.ISkinnable) 16 17 title = _('Ldaptor Web Interface') 18 19 addSlash = True 20 246226 return inevow.IRequest(context).URLPath().child('search')27 3032 if not inevow.ISession(context).getLoggedInRoot().loggedIn: 33 return login.LoginPage([str(self.baseObject), 'edit']) 34 return edit.EditPage()3537 if not inevow.ISession(context).getLoggedInRoot().loggedIn: 38 return login.LoginPage([str(self.baseObject), 'move']) 39 return move.MovePage()4042 if not inevow.ISession(context).getLoggedInRoot().loggedIn: 43 return login.LoginPage([str(self.baseObject), 'add']) 44 return add.getResource(baseObject=self.baseObject, 45 request=inevow.IRequest(context))4648 if not inevow.ISession(context).getLoggedInRoot().loggedIn: 49 return login.LoginPage([str(self.baseObject), 'delete']) 50 return delete.getResource()5153 if not inevow.ISession(context).getLoggedInRoot().loggedIn: 54 return login.LoginPage([str(self.baseObject), 'mass_change_password']) 55 return mass_change_password.MassPasswordChangePage( 56 baseObject=self.baseObject)5759 if not inevow.ISession(context).getLoggedInRoot().loggedIn: 60 return login.LoginPage([str(self.baseObject), 'change_password']) 61 return change_password.getResource()7265 val = super(LDAPDN, self).coerce(*a, **kw) 66 try: 67 dn = distinguishedname.DistinguishedName(stringValue=val) 68 except distinguishedname.InvalidRelativeDistinguishedName, e: 69 raise annotate.InputError, \ 70 "%r is not a valid LDAP DN: %s" % (val, e) 71 return dn74 implements(iskin.ISkinnable) 75 76 title = _('Ldaptor Web Interface') 77 78 addSlash = True 79 80 docFactory = loaders.xmlfile( 81 'basedn.xhtml', 82 templateDir=os.path.split(os.path.abspath(__file__))[0]) 83 88 9114093 return annotate.MethodBinding( 94 'go', 95 annotate.Method(arguments=[ 96 annotate.Argument('ctx', annotate.Context()), 97 annotate.Argument('baseDN', LDAPDN( 98 label=_('Base DN'), 99 description=_("The top-level LDAP DN you want" 100 " to browse, e.g. dc=example,dc=com"))), 101 ], 102 label=_('Go')), 103 action=_('Go'))104 109 112114 ret = super(LdaptorWebUIGadget, self).locateChild(ctx, segments) 115 if ret != rend.NotFound: 116 return ret 117 118 path = segments[0] 119 unquoted=uriUnquote(path) 120 try: 121 dn = distinguishedname.DistinguishedName(stringValue=unquoted) 122 except distinguishedname.InvalidRelativeDistinguishedName, e: 123 # TODO There's no way to throw a FormException at this stage. 124 u = url.URL.fromContext(ctx) 125 126 # TODO protect against guard bug, see 127 # http://divmod.org/users/roundup.twistd/nevow/issue74 128 u = u.child('') 129 130 # TODO freeform_post!configurableName!methodName 131 u.add('basedn', path) 132 return u, [] 133 134 r=LdaptorWebUIGadget2(baseObject=dn) 135 ctx.remember(self.config, interfaces.ILDAPConfig) 136 ctx.remember(dn, iwebui.ICurrentDN) 137 return r, segments[1:]138 139 render_i18n = i18n.render()
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Jan 19 20:02:51 2010 | http://epydoc.sourceforge.net |