diff --git a/jans-cli-tui/cli_tui/plugins/010_auth_server/agama.py b/jans-cli-tui/cli_tui/plugins/010_auth_server/agama.py index fbec7241e4e..41242ce2593 100644 --- a/jans-cli-tui/cli_tui/plugins/010_auth_server/agama.py +++ b/jans-cli-tui/cli_tui/plugins/010_auth_server/agama.py @@ -45,7 +45,6 @@ def __init__( self.main_container = HSplit([ VSplit([ - self.app.getButton(text=_("Get Projects"), name='oauth:agama:get', jans_help=_("Retreive all Agama Projects"), handler=self.get_agama_projects), self.app.getTitledText(_("Search"), name='oauth:agama:search', jans_help=_(common_strings.enter_to_search), accept_handler=self.search_agama_project, style=cli_style.edit_text), self.app.getButton(text=_("Upload Project"), name='oauth:agama:add', jans_help=_("To add a new Agama project press this button"), handler=self.upload_project), ], diff --git a/jans-cli-tui/cli_tui/plugins/010_auth_server/attributes.py b/jans-cli-tui/cli_tui/plugins/010_auth_server/attributes.py index 82afb124a30..d0870c2a139 100644 --- a/jans-cli-tui/cli_tui/plugins/010_auth_server/attributes.py +++ b/jans-cli-tui/cli_tui/plugins/010_auth_server/attributes.py @@ -42,7 +42,6 @@ def __init__( self.main_container = HSplit([ VSplit([ - self.app.getButton(text=_("Get Attributes"), name='oauth:attributes:get', jans_help=_("Retreive first {} Attributes").format(self.app.entries_per_page), handler=self.get_attributes), self.app.getTitledText(_("Search"), name='oauth:attributes:search', jans_help=_(common_strings.enter_to_search), accept_handler=self.search_attributes, style=cli_style.edit_text), self.app.getButton(text=_("Add Attribute"), name='oauth:attributes:add', jans_help=_("To add a new Agama project press this button"), handler=self.add_attributes), ], diff --git a/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py b/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py index 1228e59bbb6..e85bb8a4032 100755 --- a/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py +++ b/jans-cli-tui/cli_tui/plugins/010_auth_server/main.py @@ -100,15 +100,31 @@ async def get_appconfiguration(self) -> None: self.oauth_logging() + async def retrieve_sopes(self) -> None: """asyncio corotune for retreiving scopes """ + limit =60 + start_index = 0 + self.app.logger.debug("retreiving scopes") - cli_args = {'operation_id': 'get-oauth-scopes', 'endpoint_args': 'limit:200,startIndex:0'} + cli_args = {'operation_id': 'get-oauth-scopes', 'endpoint_args': f'limit:{limit},startIndex:{start_index}'} response = await self.app.loop.run_in_executor(self.app.executor, self.app.cli_requests, cli_args) - common_data.scopes = response.json()['entries'] + result = response.json() + max_limit = result['totalEntriesCount'] + + while(start_index < max_limit) : + if start_index < max_limit: + start_index +=limit + cli_args = {'operation_id': 'get-oauth-scopes', 'endpoint_args': f'limit:{limit},startIndex:{start_index}'} + response_new = await self.app.loop.run_in_executor(self.app.executor, self.app.cli_requests, cli_args) + result_new = response_new.json() + result['entries'].append(result_new.get('entries',[])) + + common_data.scopes = result['entries'] self.app.logger.debug("scopes retreived") + def on_cli_object_ready(self): self.authn.on_cli_object_ready() @@ -137,7 +153,6 @@ def oauth_prepare_containers(self) -> None: self.oauth_containers['scopes'] = HSplit([ VSplit([ - self.app.getButton(text=_("Get Scopes"), name='oauth:scopes:get', jans_help=_("Retreive first {} Scopes").format(self.app.entries_per_page), handler=self.oauth_get_scopes), self.app.getTitledText(_("Search"), name='oauth:scopes:search', jans_help=_(common_strings.enter_to_search), accept_handler=self.search_scope,style='class:outh_containers_scopes.text'), self.app.getButton(text=_("Add Scope"), name='oauth:scopes:add', jans_help=_("To add a new scope press this button"), handler=self.add_scope), ], @@ -149,7 +164,6 @@ def oauth_prepare_containers(self) -> None: self.oauth_containers['clients'] = HSplit([ VSplit([ - self.app.getButton(text=_("Get Clients"), name='oauth:clients:get', jans_help=_("Retreive first {} OpenID Connect clients").format(self.app.entries_per_page), handler=self.oauth_update_clients), self.app.getTitledText(_("Search"), name='oauth:clients:search', jans_help=_(common_strings.enter_to_search), accept_handler=self.search_clients,style='class:outh_containers_clients.text'), self.app.getButton(text=_("Add Client"), name='oauth:clients:add', jans_help=_("To add a new client press this button"), handler=self.add_client), diff --git a/jans-cli-tui/cli_tui/plugins/010_auth_server/ssa.py b/jans-cli-tui/cli_tui/plugins/010_auth_server/ssa.py index fa2cbe4b2ce..b6cf601b48b 100644 --- a/jans-cli-tui/cli_tui/plugins/010_auth_server/ssa.py +++ b/jans-cli-tui/cli_tui/plugins/010_auth_server/ssa.py @@ -44,7 +44,6 @@ def __init__( self.main_container = HSplit([ VSplit([ - self.app.getButton(text=_("Get SSA"), name='oauth:ssa:get', jans_help=_("Retreive all SSA"), handler=self.get_ssa), self.app.getTitledText(_("Search"), name='oauth:ssa:search', jans_help=_(common_strings.enter_to_search), accept_handler=self.search_ssa, style=cli_style.edit_text), self.app.getButton(text=_("Add SSA"), name='oauth:ssa:add', jans_help=_("To add a new SSA press this button"), handler=self.add_ssa), ], diff --git a/jans-cli-tui/cli_tui/plugins/060_scripts/main.py b/jans-cli-tui/cli_tui/plugins/060_scripts/main.py index f47c561ea9b..1c25c0afc3a 100755 --- a/jans-cli-tui/cli_tui/plugins/060_scripts/main.py +++ b/jans-cli-tui/cli_tui/plugins/060_scripts/main.py @@ -56,19 +56,15 @@ def scripts_prepare_containers(self) -> None: self.scripts_list_container = HSplit([], width=D(), height=D()) self.scripts_main_area = HSplit([ - VSplit([ - self.app.getButton(text=_("Get Scripts"), name='scripts:get', jans_help=_( - "Retreive first %d Scripts") % (20), handler=self.get_scripts), - self.app.getTitledText(_("Search"), name='scripts:search', jans_help=_( - "Press enter to perform search"), accept_handler=self.search_scripts, style='class:outh_containers_scopes.text'), - self.app.getButton(text=_("Add Script"), name='scripts:add', jans_help=_( - "To add a new scope press this button"), handler=self.add_script_dialog), - ], - padding=3, - width=D(), - ), - DynamicContainer(lambda: self.scripts_list_container) - ], style='class:outh_containers_scopes') + VSplit([ + self.app.getTitledText(_("Search"), name='scripts:search', jans_help=_("Press enter to perform search"), accept_handler=self.search_scripts, style='class:outh_containers_scopes.text'), + self.app.getButton(text=_("Add Script"), name='scripts:add', jans_help=_("To add a new scope press this button"), handler=self.add_script_dialog), + ], + padding=3, + width=D(), + ), + DynamicContainer(lambda: self.scripts_list_container) + ],style='class:outh_containers_scopes') def get_scripts( self, diff --git a/jans-cli-tui/cli_tui/plugins/070_users/main.py b/jans-cli-tui/cli_tui/plugins/070_users/main.py index d5cc2b7bc61..c0048bd2d8c 100755 --- a/jans-cli-tui/cli_tui/plugins/070_users/main.py +++ b/jans-cli-tui/cli_tui/plugins/070_users/main.py @@ -58,7 +58,6 @@ def set_center_frame(self) -> None: self.nav_buttons = VSplit([],width=D()) self.app.center_container = HSplit([ VSplit([ - self.app.getButton(text=_("Get Users"), name='oauth:scopes:get', jans_help=_("Retreive first {} users").format(self.app.entries_per_page), handler=self.get_users), self.app.getTitledText(_("Search"), name='oauth:scopes:search', jans_help=_("Press enter to perform search"), accept_handler=self.search_user, style='class:outh_containers_scopes.text'), self.app.getButton(text=_("Add Users"), name='oauth:scopes:add', jans_help=_("To add a new user press this button"), handler=self.edit_user_dialog), ], diff --git a/jans-cli-tui/wrapper_test.py b/jans-cli-tui/wrapper_test.py index 412f168ba46..710ebf8e243 100755 --- a/jans-cli-tui/wrapper_test.py +++ b/jans-cli-tui/wrapper_test.py @@ -4,14 +4,14 @@ test_client = config_cli.client_id if config_cli.test_client else None config_cli.debug = True cli_object = config_cli.JCA_CLI( - host=config_cli.host, - client_id=config_cli.client_id, - client_secret=config_cli.client_secret, - access_token=config_cli.access_token, - test_client=test_client - ) - -#print(config_cli.host, config_cli.client_id, config_cli.client_secret, config_cli.access_token, cli_object.use_test_client) + host=config_cli.host, + client_id=config_cli.client_id, + client_secret=config_cli.client_secret, + access_token=config_cli.access_token, + test_client=test_client +) + +# print(config_cli.host, config_cli.client_id, config_cli.client_secret, config_cli.access_token, cli_object.use_test_client) status = cli_object.check_connection() print(status) @@ -66,17 +66,17 @@ # endpoint_args ='pattern:2B29' ### limit the responce and wrong pattern data = {} -inum = '40a48740-4892-4fce-b30f-81c5c45670f4' ## this user has 3 UMA +inum = '40a48740-4892-4fce-b30f-81c5c45670f4' # this user has 3 UMA result = cli_object.process_command_by_id( - operation_id='get-all-attribute', - url_suffix='', - endpoint_args="pattern:3B47\,3692\,E7BC\,11AA", - data_fn=None, - data={} - ) - -x = result.json() -print(x) + operation_id='get-oauth-scopes', + url_suffix='', + endpoint_args="limit:200,startIndex:0", + data_fn=None, + data={} +) + +x = result.json() +print(x['totalEntriesCount']) # print(len(x["entries"])) # print(x["entries"]) # for i in x["entries"]: @@ -84,7 +84,6 @@ # print(i['claimName']) - # endpoint_args ='limit:1,pattern:hasdaeat' # endpoint_args ='limit:5,startIndex:0,pattern:sagasg' @@ -98,13 +97,6 @@ # print(result.text) - - - - - - - ''' [ {"dn":"jansId=5635e18b-67b9-4997-a786-a6b2cdb84355,ou=resources,ou=uma,o=jans", @@ -182,4 +174,3 @@ {"dn":"inum=C4F6,ou=scopes,o=jans","inum":"C4F6","displayName":"refresh_token","id":"offline_access","description":"This scope value requests that an OAuth 2.0 Refresh Token be issued.","scopeType":"openid","defaultScope":true,"attributes":{"showInConfigurationEndpoint":true},"creationDate":"2022-09-24T07:07:19","umaType":false,"baseDn":"inum=C4F6,ou=scopes,o=jans"}] ''' -