def linkedattr_show(inst, basedn, log, args): log = log.getChild('linkedattr_show') configs = LinkedAttributesConfigs(inst) config = configs.get(args.NAME) if not config.exists(): raise ldap.NO_SUCH_OBJECT("Entry %s doesn't exists" % args.name) if args and args.json: o_str = config.get_all_attrs_json() log.info(o_str) else: log.info(config.display())
def linkedattr_list(inst, basedn, log, args): log = log.getChild('linkedattr_list') configs = LinkedAttributesConfigs(inst) result = [] result_json = [] for config in configs.list(): if args.json: result_json.append(json.loads(config.get_all_attrs_json())) else: result.append(config.rdn) if args.json: log.info(json.dumps({"type": "list", "items": result_json}, indent=4)) else: if len(result) > 0: for i in result: log.info(i) else: log.info("No Linked Attributes plugin config instances")
def linkedattr_del(inst, basedn, log, args): log = log.getChild('linkedattr_del') configs = LinkedAttributesConfigs(inst) config = configs.get(args.NAME) config.delete() log.info("Successfully deleted the %s", config.dn)
def linkedattr_edit(inst, basedn, log, args): log = log.getChild('linkedattr_edit') configs = LinkedAttributesConfigs(inst) config = configs.get(args.NAME) generic_object_edit(config, log, args, arg_to_attr)