Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pass
if not possible:
raise ldapsyntax.CannotRemoveRDNError \
(rdn.attributeType,
rdn.value)
newRDN.append(distinguishedname.LDAPAttributeTypeAndValue(attributeType=attr,
value=possible[0]))
old.remove(rdn.value)
try:
new.remove(possible[0])
except ValueError:
pass
if newRDN is not None:
newRDN = distinguishedname.RelativeDistinguishedName(newRDN)
changes_desc[tags.li[
_("changing %s: changing RDN to say %s") \
%(repr(attr), newRDN)]]
newDN = distinguishedname.DistinguishedName(
(newRDN,)+self.entry.dn.split()[1:]
)
def _move(_):
return self.entry.move(newDN)
d.addCallback(_move)
def _redirect(r, ctx, newDN):
request = inevow.IRequest(ctx)
u = url.URL.fromContext(ctx).curdir()
u = u.child(uriQuote(newDN))
request.setComponent(iformless.IRedirectAfterPost, u)
return r
d.addCallback(_redirect, context, newDN)
for attr,old,new in changes:
def bind_setPassword(self, ctx):
return annotate.MethodBinding(
'setPassword',
annotate.Method(arguments=[
annotate.Argument('ctx', annotate.Context()),
annotate.Argument('newPassword', annotate.PasswordEntry(required=True,
label=_('New password'))),
annotate.Argument('again', annotate.PasswordEntry(required=True,
label=_('Again'))),
],
label=_('Set password')),
action=_('Set password'))
def bind_setServicePassword(self, ctx):
return annotate.MethodBinding(
'setServicePassword',
annotate.Method(arguments=[
annotate.Argument('ctx', annotate.Context()),
annotate.Argument('newPassword', annotate.PasswordEntry(required=True,
label=_('New password'))),
annotate.Argument('again', annotate.PasswordEntry(required=True,
label=_('Again'))),
],
label=_('Set password')),
action=_('Set password'))
def _report(name):
return _('Set password for service %r') % name
d.addCallback(_report)
if e is None:
return context.tag.clear()[obj]
u=url.URL.fromContext(context)
u=u.parentdir().parentdir().parentdir().clear()
return context.tag.clear()[
_("Added "),
tags.a(href=u.parentdir().child(e.dn).child("search"))[e.dn],
_(" successfully. "),
# TODO share implementation with entryLinks
'[',
tags.a(href=u.sibling('edit').child(uriQuote(e.dn)))[_('edit')],
'|',
tags.a(href=u.sibling('move').child(uriQuote(e.dn)))[_('move')],
'|',
tags.a(href=u.sibling('delete').child(uriQuote(e.dn)))[_('delete')],
'|',
tags.a(href=u.sibling('change_password').child(uriQuote(e.dn)))[_('change password')],
']',
]
def bind_add(self, ctx):
return annotate.MethodBinding(
'add',
annotate.Method(arguments=[
annotate.Argument('ctx', annotate.Context()),
annotate.Argument('serviceName', annotate.String(required=True,
label=_('Service name'))),
annotate.Argument('newPassword', annotate.PasswordEntry(required=False,
label=_('New password'),
description=_("Leave empty to generate random password."))),
annotate.Argument('again', annotate.PasswordEntry(required=False,
label=_('Again'))),
],
label=_('Add')),
action=_('Add'))
def bind_remove(self, ctx):
return annotate.MethodBinding(
'remove',
annotate.Method(arguments=[
annotate.Argument('ctx', annotate.Context()),
],
label=_('Remove')),
action=_('Remove'))
def checkPasswordTypos(newPassword, again):
if newPassword != again:
raise annotate.ValidateError(
{},
formErrorMessage=_('Passwords do not match.'))
def cancel(self, context):
self._remove(context)
return _('Cancelled move of %s') % self.original.dn
u=url.URL.fromContext(context)
u=u.parentdir().parentdir().parentdir().clear()
return context.tag.clear()[
_("Added "),
tags.a(href=u.parentdir().child(e.dn).child("search"))[e.dn],
_(" successfully. "),
# TODO share implementation with entryLinks
'[',
tags.a(href=u.sibling('edit').child(uriQuote(e.dn)))[_('edit')],
'|',
tags.a(href=u.sibling('move').child(uriQuote(e.dn)))[_('move')],
'|',
tags.a(href=u.sibling('delete').child(uriQuote(e.dn)))[_('delete')],
'|',
tags.a(href=u.sibling('change_password').child(uriQuote(e.dn)))[_('change password')],
']',
]