Beispiel #1
0
 def __call__(self, args):
     super(InconsistentUsersListCommand, self).__call__(args)
     endpoint = self.ls.iusers
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_filters(PartialOr(self.IDENTIFIER, args.identifiers, True), )
     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()
 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()
Beispiel #5
0
 def __call__(self, args):
     super(ListCommand, self).__call__(args)
     endpoint = self.ls.shared_spaces
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_filters(PartialOr(self.IDENTIFIER, args.names, True),
                     PartialOr(self.RESOURCE_IDENTIFIER, args.uuids, True))
     return tbu.build().load_v2(endpoint.list()).render()
Beispiel #6
0
 def __call__(self, args):
     super(DocumentsListCommand, self).__call__(args)
     endpoint = self.ls.documents
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_action('share', ShareAction(self.api_version))
     tbu.add_filters(PartialOr(self.IDENTIFIER, args.names, True),
                     PartialDate("creationDate", args.cdate))
     return tbu.build().load_v2(endpoint.list()).render()
Beispiel #7
0
 def __call__(self, args):
     super(DetailCommand, self).__call__(args)
     endpoint = self.ls.shared_spaces
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     json_obj = []
     for uuid in args.uuids:
         json_obj.append(endpoint.get(uuid))
     return tbu.build().load_v2(json_obj).render()
Beispiel #8
0
 def __call__(self, args):
     super(DomainPatternsListCommand, self).__call__(args)
     if self.api_version == 0:
         self.init_old_language_key()
     endpoint = self.ls.domain_patterns
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_filters(PartialOr(self.IDENTIFIER, args.identifiers, True), )
     return tbu.build().load_v2(endpoint.list(args.model)).render()
Beispiel #9
0
 def __call__(self, args):
     super(ThreadMembersListCommand, self).__call__(args)
     endpoint = self.ls.thread_members
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_filters(
         PartialOr(self.IDENTIFIER, args.identifiers, True)
     )
     return tbu.build().load_v2(endpoint.list(args.thread_uuid)).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(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()
Beispiel #12
0
 def __call__(self, args):
     super(ReceivedSharesListCommand, self).__call__(args)
     endpoint = self.ls.rshares
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_filters(
         PartialOr(self.IDENTIFIER, args.names, True),
         PartialDate("creationDate", args.cdate)
     )
     return tbu.build().load_v2(endpoint.list()).render()
Beispiel #13
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()
Beispiel #14
0
 def __call__(self, args):
     super(ListCommand, self).__call__(args)
     endpoint = self.ls.contactslistscontacts
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     tbu.add_action(
         'delete',
         DeleteAction(mode=self.CFG_DELETE_MODE,
                      parent_identifier=self.CFG_DELETE_ARG_ATTR))
     tbu.add_filters(PartialOr(self.IDENTIFIER, args.pattern, True))
     json_obj = endpoint.list(args.mailing_list_uuid)
     return tbu.build().load_v2(json_obj).render()
Beispiel #15
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()
Beispiel #16
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()
Beispiel #17
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()
Beispiel #18
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()
Beispiel #19
0
 def __call__(self, args):
     super(UsersListCommand, self).__call__(args)
     endpoint = self.ls.users
     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))
     return tbu.build().load_v2(endpoint.list()).render()
Beispiel #20
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()
Beispiel #21
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()
 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()
Beispiel #23
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()
 def __call__(self, args):
     super(AuthenticationListCommand, self).__call__(args)
     endpoint = self.ls.authentication
     tbu = TableBuilder(self.ls, endpoint, self.IDENTIFIER)
     tbu.load_args(args)
     return tbu.build().load_v2(endpoint.list()).render()