Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-50 Update ee auth list command by adding support for listing all auths across all sites #51

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

kirtangajjar
Copy link
Contributor

@kirtangajjar kirtangajjar commented Sep 20, 2021

Added support for listing all auths across all sites

What's changed

  • Running the ee auth list command from outside of site directory will display all the auths across all the sites.

What's remain same

  • Running the ee auth list command from within the site directory will display all the auths of that particular site only.

Files to check out

src/Auth_Command.php

closes #50

@PiyushKhurana
Copy link

PiyushKhurana commented Sep 21, 2021

@kirtangajjar
The current ee auth command works this way:- (ignoring global option)

  • If sitename given ee auth list example.com or If run ee auth list from within the site folder , it will give only that site auth list.
  • But if no sitename is given , that is , command is run like this ee auth list and it is also not inside the sitefolder , the EE will give this error Could not find the site you wish to run auth list command on. Either pass it as an argument: ee auth list or run ee auth list from inside the site folder.
  • So now, If we want to provide feature of listing all the sites on ee auth list we will have to remove this error msg and instead display all the auth list and give a message/warning stating that You are seeing auth list of all sites , if you want to see for particular site , run this command from within site folder or provide sitename in command itself

@kirtangajjar
Copy link
Contributor Author

kirtangajjar commented Sep 21, 2021

  • So now, If we want to provide feature of listing all the sites on ee auth list we will have to remove this error msg and instead display all the auth list and give a message/warning stating that You are seeing auth list of all sites , if you want to see for particular site , run this command from within site folder or provide sitename in command itself

@PiyushKhurana Do one thing, handle it in your code. If the user is in the site directory, then show site's info else global info. Hint: try to find out how Easyengine does this. We have made a function for it.

So if the user is within an site directory, you don't need to show global auth, just let he program continue, and it will do it's job. If not, then invoke your logic of global auth.

-  Add condition to check whether command is run from inside site directory or  not
-  Use usort function to sort the array
- Use array_map to add new field 'sitename' to each array element
@PiyushKhurana PiyushKhurana changed the title Feature/ee auth list v2 GH-50 Update ee auth list command by adding support for listing all auths across all sites Sep 21, 2021
Copy link

@PiyushKhurana PiyushKhurana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirtangajjar You can check the code. It is complete from my end.

if ( empty( $sites ) ) {
EE::error( 'No auths exits on any sites' );
}
$formatter = new EE\Formatter( $assoc_args, array( 'sitename', 'username', 'password' ) );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirtangajjar While working on other issue , I came across a condition where there was not auth on any sites , so I have added the condition to check if there are no auths at all on any sites in that case it will simply show a error message instead of showing empty table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List all auths on all sites
2 participants