Esempio n. 1
0
 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(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()
Esempio n. 3
0
 def __call__(self, args):
     super(UsersListCommand, self).__call__(args)
     if not  (args.firstname or args.lastname or args.mail):
         raise ValueError('You should use at leat one option among : --firstname, --lastname or --mail')
     endpoint = self.ls.users
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_custom_cell("domain", CellBuilder('{value:.8}', '{value}'))
     json_obj = endpoint.search(args.firstname, args.lastname, args.mail)
     return tbu.build().load_v2(json_obj).render()
Esempio n. 4
0
 def __call__(self, args):
     super(DomainPoliciesListCommand, self).__call__(args)
     endpoint = self.ls.domain_policies
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_custom_cell("accessPolicy", AccessPolicyCell)
     tbu.add_filters(PartialOr(self.IDENTIFIER, args.identifiers, True), )
     table = tbu.build()
     table.align['accessPolicy'] = "l"
     return table.load_v2(endpoint.list()).render()
Esempio n. 5
0
 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()
Esempio n. 6
0
 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()
Esempio n. 7
0
 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()
Esempio n. 8
0
 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()
Esempio n. 9
0
 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()
Esempio n. 10
0
 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()
Esempio n. 11
0
 def __call__(self, args):
     super(JwtListAuditCommand, self).__call__(args)
     endpoint = self.ls.jwt.audit
     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", ActorCell)
     tbu.add_custom_cell("authUser", AuthUserCell)
     tbu.add_custom_cell("uuid", CellBuilder('{value:.8}', '{value}'))
     tbu.add_custom_cell("resource", ResourceCell)
     return tbu.build().load_v2(endpoint.list()).render()
 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()
Esempio n. 13
0
 def __call__(self, args):
     super(FunctionalityListCommand, self).__call__(args)
     endpoint = self.ls.funcs
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_custom_cell("parameters", ParameterCell)
     tbu.add_custom_cell("activationPolicy", PolicyCell)
     tbu.add_custom_cell("configurationPolicy", PolicyCell)
     tbu.add_custom_cell("delegationPolicy", PolicyCell)
     tbu.add_filters(PartialOr(self.IDENTIFIER, args.identifiers, True),
                     PartialOr("type", args.funct_type, True))
     json_obj = endpoint.list(args.domain, args.sub_funcs)
     table = tbu.build()
     table.align['parameters'] = "l"
     return table.load_v2(json_obj).render()
Esempio n. 14
0
 def __call__(self, args):
     super(UpgradeTasksListCommand, self).__call__(args)
     endpoint = self.ls.upgrade_tasks
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_custom_cell("criticity", CriticityCell)
     tbu.add_filters(PartialDate("creationDate", args.cdate), )
     tbu.add_filter_cond(
         not args.identifier,
         PartialOr(self.IDENTIFIER, [args.identifier], True))
     tbu.add_filter_cond(args.identifier and args.run,
                         Equals("criticity", args.criticity))
     json_obj = None
     if args.identifier:
         if args.run:
             tbu.endpoint = self.ls.upgrade_tasks.async_tasks.console
             json_obj = tbu.endpoint.list(args.identifier, args.run)
             tbu.horizontal_clazz = ConsoleTable
         else:
             tbu.endpoint = self.ls.upgrade_tasks.async_tasks
             json_obj = tbu.endpoint.list(args.identifier)
     else:
         json_obj = endpoint.list()
     return tbu.build().load_v2(json_obj).render()