def attruniq_status(inst, basedn, log, args): log = log.getChild('attruniq_status') plugins = AttributeUniquenessPlugins(inst) plugin = plugins.get(args.NAME) if plugin.status() is True: log.info("Plugin '%s' is enabled" % plugin.rdn) else: log.info("Plugin '%s' is disabled" % plugin.rdn)
def attruniq_enable(inst, basedn, log, args): log = log.getChild('attruniq_enable') plugins = AttributeUniquenessPlugins(inst) plugin = plugins.get(args.NAME) if plugin.status(): log.info("Plugin '%s' already enabled" % plugin.rdn) else: plugin.enable() log.info("Successfully enabled the %s", plugin.dn)
def attruniq_show(inst, basedn, log, args): log = log.getChild('attruniq_show') plugins = AttributeUniquenessPlugins(inst) plugin = plugins.get(args.NAME) if not plugin.exists(): raise ldap.NO_SUCH_OBJECT("Entry %s doesn't exists" % args.name) if args and args.json: log.info(plugin.get_all_attrs_json()) else: log.info(plugin.display())
def attruniq_del(inst, basedn, log, args): log = log.getChild('attruniq_del') plugins = AttributeUniquenessPlugins(inst) plugin = plugins.get(args.NAME) plugin.delete() log.info("Successfully deleted the %s", plugin.dn)
def attruniq_edit(inst, basedn, log, args): log = log.getChild('attruniq_edit') plugins = AttributeUniquenessPlugins(inst) plugin = plugins.get(args.NAME) generic_object_edit(plugin, log, args, arg_to_attr)