def __call__(self, args): super(ListCommand, self).__call__(args) endpoint = self.ls.shared_spaces.members tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.add_custom_cell( "role", ComplexCellBuilder( '{name}\n({uuid:.8})', '{name} ({uuid:})', '{name}', )) tbu.add_custom_cell( "account", ComplexCellBuilder('{name}\n({uuid:.8})', '{name} <{mail}> ({uuid})')) tbu.add_custom_cell( "node", ComplexCellBuilder('{nodeType}: {name} ({uuid:.8})')) tbu.add_action( 'delete', DeleteAction(mode=self.CFG_DELETE_MODE, parent_identifier=self.CFG_DELETE_ARG_ATTR)) tbu.add_filters(PartialOr(self.IDENTIFIER, args.names, True), PartialOr(self.RESOURCE_IDENTIFIER, args.uuids, True), PartialOr("role", args.roles, True, match_raw=False)) return tbu.build().load_v2(endpoint.list(args.ss_uuid)).render()
def __call__(self, args): super(JwtListCommand, self).__call__(args) endpoint = self.ls.jwt tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.add_filters( PartialOr(self.IDENTIFIER, args.identifiers, True), PartialOr(self.RESOURCE_IDENTIFIER, args.uuids, True), ) tbu.add_custom_cell("actor", ComplexCellBuilder('{name} ({uuid})')) tbu.add_custom_cell("domain", ComplexCellBuilder('{name} ({uuid})')) return tbu.build().load_v2(endpoint.list()).render()
def __call__(self, args): super(WelcomeMessagesListCommand, self).__call__(args) endpoint = self.ls.welcome_messages tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.add_custom_cell("welcomeMessagesEntries", WelcomeEntriesCell) tbu.add_custom_cell("myDomain", ComplexCellBuilder('{label} <{identifier}>')) tbu.add_filters(PartialOr(self.IDENTIFIER, args.identifiers, True), ) json_obj = [] if args.detail: keys = [] keys.append(self.IDENTIFIER) keys.append(self.RESOURCE_IDENTIFIER) keys += endpoint.languages() tbu.columns = keys tbu.vertical = True filteror = PartialOr(self.IDENTIFIER, args.identifiers, True) for json_row in endpoint.list(args.current_domain): if filteror(json_row): data = json_row.get('welcomeMessagesEntries') data[self.IDENTIFIER] = json_row.get(self.IDENTIFIER) data[self.RESOURCE_IDENTIFIER] = json_row.get( self.RESOURCE_IDENTIFIER) json_obj.append(data) # json_obj = sorted(json_obj, reverse=args.reverse, key=lambda x: x.get(table.sortby)) else: json_obj = endpoint.list(args.current_domain) table = tbu.build() return table.load_v2(json_obj).render()
def __call__(self, args): super(WgNodeContentListCommand, self).__call__(args) endpoint = self.ls.workgroup_nodes parent = None if args.folders: parent = get_uuid_from(args.folders[-1]) tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.add_custom_cell("lastAuthor", ComplexCellBuilder('{name} <{mail}>')) tbu.add_action( 'download', DownloadAction(mode=self.CFG_DOWNLOAD_MODE, parent_identifier=self.CFG_DOWNLOAD_ARG_ATTR)) tbu.add_action( 'delete', DeleteAction(mode=self.CFG_DELETE_MODE, parent_identifier=self.CFG_DELETE_ARG_ATTR)) tbu.add_filters(PartialOr(self.IDENTIFIER, args.names, True), PartialDate("creationDate", args.cdate)) json_obj = endpoint.list(args.wg_uuid, parent, flat=args.flat_mode, node_types=args.node_types) tbu.add_pre_render_class(Breadcrumb()) return tbu.build().load_v2(json_obj).render()
def __call__(self, args): super(ListCommand, self).__call__(args) endpoint = self.ls.contactslists tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.add_custom_cell("owner", ComplexCellBuilder('{firstName} {lastName} <{mail}>')) tbu.add_filters( PartialOr(self.IDENTIFIER, args.pattern, True) ) return tbu.build().load_v2(endpoint.list()).render()
def __call__(self, args): super(DomainsListCommand, self).__call__(args) if self.api_version == 0: self.init_old_language_key() endpoint = self.ls.domains tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.add_custom_cell("currentWelcomeMessage", ComplexCellBuilder('{name} ({uuid:.8})')) tbu.add_custom_cell("providers", ProviderCell) tbu.add_filters( PartialOr(self.IDENTIFIER, args.identifiers, True), ) return tbu.build().load_v2(endpoint.list()).render()
def __call__(self, args): super(GuestsInfoCommand, self).__call__(args) endpoint = self.ls.guests tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.vertical = True tbu.extended = True json_obj = [] for uuid in args.uuids: json_obj.append(endpoint.get(uuid)) tbu.add_custom_cell( "owner", ComplexCellBuilder('{firstName} {lastName} <{mail}>')) return tbu.build().load_v2(json_obj).render()
def __call__(self, args): super(GuestsListCommand, self).__call__(args) endpoint = self.ls.guests tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.load_args(args) tbu.add_filters( PartialMultipleAnd( { "mail": args.mail, "firstName": args.firstname, "lastName": args.lastname }, True), PartialOr("uuid", args.uuid), PartialOr(self.IDENTIFIER, args.pattern, True)) tbu.add_custom_cell( "owner", ComplexCellBuilder('{firstName} {lastName} <{mail}>')) return tbu.build().load_v2(endpoint.list()).render()
def __call__(self, args): super(WgNodeContentDisplayCommand, self).__call__(args) endpoint = self.ls.workgroup_nodes tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER) tbu.vertical = True tbu.load_args(args) tbu.add_custom_cell("lastAuthor", ComplexCellBuilder('{name} <{mail}>')) tbu.add_custom_cell("treePath", TreeCell) tbu.columns = endpoint.get_rbu().get_keys(args.extended) tbu.columns.append('treePath') json_obj = [] for node_uuid in args.nodes: node_uuid = get_uuid_from(node_uuid) node = endpoint.get(args.wg_uuid, node_uuid, tree=True) # self.pretty_json(node) json_obj.append(node) return tbu.build().load_v2(json_obj).render()