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

Rename create/delete to add/remove #3

Open
wants to merge 2 commits into
base: feature/auth-admin-tools
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions src/Auth_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

use EE\Model\Auth;
use EE\Model\Whitelist;
use EE\Model\Site;
use Symfony\Component\Filesystem\Filesystem;
use function EE\Auth\Utils\verify_htpasswd_is_present;
use function EE\Site\Utils\auto_site_name;
Expand Down Expand Up @@ -44,7 +43,7 @@ public function __construct() {
}

/**
* Creates http authentication for a site.
* Adds http authentication for a site.
*
* ## OPTIONS
*
Expand All @@ -63,31 +62,33 @@ public function __construct() {
* ## EXAMPLES
*
* # Add auth on site with default username(easyengine) and random password
* $ ee auth create example.com
* $ ee auth add example.com
*
* # Add auth on all sites with default username and random password
* $ ee auth create global
* $ ee auth add global
*
* # Add auth on site with predefined username and password
* $ ee auth create example.com --user=test --pass=password
* $ ee auth add example.com --user=test --pass=password
*
* # Add auth on site with default username and random password
* $ ee auth create example.com --pass=password
* $ ee auth add example.com --pass=password
*
* # Add auth on admin-tools with username and random password
* $ ee auth create admin-tools --user=test
* $ ee auth add admin-tools --user=test
*
* # Add auth on admin-tools with username and password
* $ ee auth create admin-tools --user=password
* $ ee auth addadmin-tools --user=password
*
* # Whitelist IP on site
* $ ee auth create example.com --ip=8.8.8.8,1.1.1.1
* $ ee auth add example.com --ip=8.8.8.8,1.1.1.1
*
* # Whitelist IP on all sites
* $ ee auth create global --ip=8.8.8.8,1.1.1.1
* $ ee auth add global --ip=8.8.8.8,1.1.1.1
*
* @alias create
*
*/
public function create( $args, $assoc_args ) {

public function add( $args, $assoc_args ) {
verify_htpasswd_is_present();

$global = $this->populate_info( $args, __FUNCTION__ );
Expand Down Expand Up @@ -569,7 +570,7 @@ private function get_auths( $site_url, $user, $error_if_empty = true ) {
}

/**
* Deletes http authentication for a site.
* Remove http authentication from a site.
*
* Default: removes http authentication from site. If `--user` is passed it removes that specific user.
*
Expand All @@ -590,30 +591,32 @@ private function get_auths( $site_url, $user, $error_if_empty = true ) {
* ## EXAMPLES
*
* # Remove auth on site and its admin tools with default username(easyengine)
* $ ee auth delete example.com
* $ ee auth remove example.com
*
* # Remove auth on site and its admin tools with custom username
* $ ee auth delete example.com --user=example
* $ ee auth remove example.com --user=example
*
* # Remove global auth on all sites (but not admin tools) with default username(easyengine)
* $ ee auth delete global
* $ ee auth remove global
*
* # Remove auth on `admin-tools` with custom username
* $ ee auth delete admin-tools --user=test
* $ ee auth remove admin-tools --user=test
*
* # Remove auth on `admin-tools` with custom username without asking for confirmation
* $ ee auth delete admin-tools --user=test --yes
* $ ee auth remove admin-tools --user=test --yes
*
* # Remove specific whitelisted IPs on site
* $ ee auth delete example.com --ip=1.1.1.1,8.8.8.8
* $ ee auth remove example.com --ip=1.1.1.1,8.8.8.8
*
* # Remove all whitelisted IPs on site
* $ ee auth delete example.com --ip
* $ ee auth remove example.com --ip
*
* # Remove whitelisted IPs on all sites
* $ ee auth delete global --ip=1.1.1.1
* $ ee auth remove global --ip=1.1.1.1
*
* @alias delete
*/
public function delete( $args, $assoc_args ) {
public function remove( $args, $assoc_args ) {
verify_htpasswd_is_present();

$global = $this->populate_info( $args, __FUNCTION__ );
Expand Down