[ajax] use a custom tag to handle dynamically loaded js
Using <pre class="script"> makes it trivial for a malicious user to
inject arbitrary javascript into a html or rest text element (because it
looks innocent to the html sanitizer). Using a custom tag we can be
sure that it actually comes from our code and not from untrusted user
data. IE ignores custom tags, though, so we put it in its own namespace.
https://extranet.logilab.fr/1530578
frombase64importb64decode,b64encodetry:uri,newdn=__args__exceptValueError:print'USAGE: cubicweb-ctl shell <instance> ldap_change_base_dn.py -- <ldap source uri> <new dn>'printprint'you should not have updated your sources file yet'olddn=repo.config.sources()[uri]['user-base-dn']assertolddn!=newdnraw_input("Ensure you've stopped the instance, type enter when done.")foreid,extidinsql("SELECT eid, extid FROM entities WHERE source='%s'"%uri):olduserdn=b64decode(extid)newuserdn=olduserdn.replace(olddn,newdn)ifnewuserdn!=olduserdn:printolduserdn,'->',newuserdnsql("UPDATE entities SET extid='%s' WHERE eid=%s"%(b64encode(newuserdn),eid))commit()print'you can now update the sources file to the new dn and restart the instance'