Skip to content

Commit

Permalink
Merge 7b10066 into cc94231
Browse files Browse the repository at this point in the history
  • Loading branch information
manageruz committed Oct 25, 2022
2 parents cc94231 + 7b10066 commit ecc3163
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 53 deletions.
12 changes: 6 additions & 6 deletions src/AuthTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ trait AuthTrait
*
* @param string $uri
*
* @throws RedirectException
*
* @return bool
*
* @throws RedirectException
*/
public function restrict(?string $uri = null, bool $returnOnly = false)
{
Expand Down Expand Up @@ -84,9 +84,9 @@ public function restrict(?string $uri = null, bool $returnOnly = false)
* @param mixed $groups
* @param string $uri The URI to redirect to on fail.
*
* @throws RedirectException
*
* @return bool
*
* @throws RedirectException
*/
public function restrictToGroups($groups, $uri = null)
{
Expand Down Expand Up @@ -119,9 +119,9 @@ public function restrictToGroups($groups, $uri = null)
* @param int|int[]|string|string[] $permissions
* @param string $uri The URI to redirect to on fail.
*
* @throws RedirectException
*
* @return bool
*
* @throws RedirectException
*/
public function restrictWithPermissions($permissions, $uri = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Authentication/AuthenticationBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ public function retrieveUser(array $wheres)
->first();
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Model Setters
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Sets the model that should be used to work with
Expand Down
2 changes: 1 addition & 1 deletion src/Authentication/Passwords/NothingPersonalValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function isNotPersonal($password, $user)

foreach ($haystacks as $haystack) {
if (empty($haystack) || in_array($haystack, $trivial, true)) {
continue; //ignore trivial words
continue; // ignore trivial words
}

foreach ($needles as $needle) {
Expand Down
12 changes: 6 additions & 6 deletions src/Authorization/AuthorizeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ interface AuthorizeInterface
*/
public function error();

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Actions
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Checks to see if a user is in a group.
Expand Down Expand Up @@ -75,9 +75,9 @@ public function addPermissionToGroup($permission, $group);
*/
public function removePermissionFromGroup($permission, $group);

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Groups
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Grabs the details about a single group.
Expand Down Expand Up @@ -114,9 +114,9 @@ public function deleteGroup(int $groupId);
*/
public function updateGroup(int $id, string $name, string $description = '');

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Permissions
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Returns the details about a single permission.
Expand Down
12 changes: 6 additions & 6 deletions src/Authorization/FlatAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public function setUserModel(Model $model)
return $this;
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Actions
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Checks to see if a user is in a group.
Expand Down Expand Up @@ -400,9 +400,9 @@ public function doesUserHavePermission($userId, $permission)
return $this->permissionModel->doesUserHavePermission($userId, $permissionId);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Groups
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Grabs the details about a single group.
Expand Down Expand Up @@ -530,9 +530,9 @@ protected function getGroupID($group)
return (int) $g->id;
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Permissions
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Returns the details about a single permission.
Expand Down
2 changes: 1 addition & 1 deletion src/Collectors/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Auth extends BaseCollector
*/
protected $title = 'Auth';

//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Returns any information that should be shown next to the title.
Expand Down
6 changes: 3 additions & 3 deletions src/Commands/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class Publish extends BaseCommand
*/
protected $entityPublished = false;

//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Displays the help for the spark cli script itself.
Expand Down Expand Up @@ -260,9 +260,9 @@ protected function publishLanguage()
$this->writeFile('Language/en/Auth.php', $content);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Utilities
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Replaces the Myth\Auth namespace in the published
Expand Down
12 changes: 6 additions & 6 deletions src/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function __construct()
$this->auth = service('authentication');
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Login/out
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Displays the login form, or redirects
Expand Down Expand Up @@ -111,9 +111,9 @@ public function logout()
return redirect()->to(site_url('/'));
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Register
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Displays the user registration page.
Expand Down Expand Up @@ -196,9 +196,9 @@ public function attemptRegister()
return redirect()->route('login')->with('message', lang('Auth.registerSuccess'));
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Forgot Password
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Displays the forgot password form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function up()
$this->forge->createTable('auth_users_permissions', true);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

public function down()
{
Expand Down
12 changes: 6 additions & 6 deletions src/Entities/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ public function setForcePassReset($force_pass_reset)
* Force a user to reset their password on next page refresh
* or login. Checked in the LocalAuthenticator's check() method.
*
* @throws Exception
*
* @return $this
*
* @throws Exception
*/
public function forcePasswordReset()
{
Expand All @@ -124,9 +124,9 @@ public function forcePasswordReset()
* Generates a secure hash to use for password reset purposes,
* saves it to the instance.
*
* @throws Exception
*
* @return $this
*
* @throws Exception
*/
public function generateResetHash()
{
Expand All @@ -139,9 +139,9 @@ public function generateResetHash()
/**
* Generates a secure random hash to use for account activation.
*
* @throws Exception
*
* @return $this
*
* @throws Exception
*/
public function generateActivateHash()
{
Expand Down
12 changes: 6 additions & 6 deletions src/Models/GroupModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class GroupModel extends Model
*/
protected string $permissionModel = PermissionModel::class;

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Users
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Adds a single user to a single group.
Expand Down Expand Up @@ -128,9 +128,9 @@ public function getUsersForGroup(int $groupId)
return $found;
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Permissions
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Gets all permissions for a group in a way that can be
Expand Down Expand Up @@ -172,7 +172,7 @@ public function addPermissionToGroup(int $permissionId, int $groupId)
return $this->db->table('auth_groups_permissions')->insert($data);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Removes a single permission from a single group.
Expand All @@ -188,7 +188,7 @@ public function removePermissionFromGroup(int $permissionId, int $groupId)
])->delete();
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Removes a single permission from all groups.
Expand Down
2 changes: 1 addition & 1 deletion tests/authentication/AuthenticationBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testLoginSuccessNoRemember()
]);

// TODO: some BDD send back strings : should we forcefullyconvert in Authentication\AuthenticationBase::login() ?
//$this->assertSame(4, $_SESSION['logged_in']);
// $this->assertSame(4, $_SESSION['logged_in']);
$this->assertContains($_SESSION['logged_in'], [4, '4']);

$this->dontSeeInDatabase('auth_tokens', [
Expand Down
2 changes: 1 addition & 1 deletion tests/authorization/FlatAuthorizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function testGetPermissionsForUser()
$this->assertIsArray($this->permissions->getPermissionsForUser($user->id));
$this->assertSame([], $this->permissions->getPermissionsForUser($user->id));

$this->auth->addPermissionToUser($permission->id, $user->id); //user's permissions
$this->auth->addPermissionToUser($permission->id, $user->id); // user's permissions
$this->auth->addPermissionToGroup($permission2->id, $group->id); // groups permission
$this->auth->addUserToGroup($user->id, $group->id);

Expand Down
14 changes: 7 additions & 7 deletions tests/unit/ValidationRulesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ValidationRulesTest extends CIUnitTestCase
{
protected Validation $validation;

//--------------------------------------------------------------------
// --------------------------------------------------------------------

protected function setUp(): void
{
Expand All @@ -32,7 +32,7 @@ protected function setUp(): void
$this->validation->reset();
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

public function testStrongPasswordLongRule()
{
Expand All @@ -50,7 +50,7 @@ public function testStrongPasswordLongRule()
$this->assertTrue($this->validation->run($data));
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

public function testStrongPasswordLongRuleWithPostRequest()
{
Expand All @@ -70,7 +70,7 @@ public function testStrongPasswordLongRuleWithPostRequest()
$this->assertTrue($result);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

public function testStrongPasswordLongRuleWithRawInputRequest()
{
Expand All @@ -90,7 +90,7 @@ public function testStrongPasswordLongRuleWithRawInputRequest()
$this->assertTrue($result);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

public function testStrongPasswordShortRuleWithPostRequest()
{
Expand All @@ -110,7 +110,7 @@ public function testStrongPasswordShortRuleWithPostRequest()
$this->assertTrue($result);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

public function testStrongPasswordShortRuleWithErrors()
{
Expand All @@ -133,7 +133,7 @@ public function testStrongPasswordShortRuleWithErrors()
], $this->validation->getErrors());
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------

public function testStrongPasswordLongRuleWithErrors()
{
Expand Down

0 comments on commit ecc3163

Please sign in to comment.