Skip to content

Conversation

Dobmod
Copy link
Member

@Dobmod Dobmod commented Aug 12, 2024

  • Added GetImplicitUsersForResource,GetAllowedObjectConditions,GetAllDomains,GetAllRolesByDomain to RBAC API
  • Added GetDomains,GetAllDomains to RoleManager API
  • Added two exception classes named ObjConditionException and EmptyConditionException
  • Copied unit tests from core library

@coveralls
Copy link

coveralls commented Aug 12, 2024

Pull Request Test Coverage Report for Build 10439810437

Details

  • 72 of 76 (94.74%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 93.718%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Enforcer.php 72 74 97.3%
src/Rbac/DefaultRoleManager/RoleManager.php 0 2 0.0%
Totals Coverage Status
Change from base Build 9533077269: 0.05%
Covered Lines: 1656
Relevant Lines: 1767

💛 - Coveralls

@Dobmod Dobmod force-pushed the feature-more-api-1.0 branch from 5ecb589 to 535d0fd Compare August 12, 2024 15:08
src/Enforcer.php Outdated
Comment on lines 534 to 543

$trimPrefix = function ($string, $prefix) {
if (strpos($string, $prefix) === 0) {
return substr($string, strlen($prefix));
} else {
return $string;
}
};

$objectConditions[] = $trimPrefix($policy[1], $prefix);
Copy link
Member

Choose a reason for hiding this comment

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

Please simplify this code

Suggested change
$trimPrefix = function ($string, $prefix) {
if (strpos($string, $prefix) === 0) {
return substr($string, strlen($prefix));
} else {
return $string;
}
};
$objectConditions[] = $trimPrefix($policy[1], $prefix);
$objectConditions[] = substr($policy[1], strlen($prefix);

src/Enforcer.php Outdated
Comment on lines 579 to 573
foreach ($roles as $role) {
$isRole[$role] = true;
}
Copy link
Member

Choose a reason for hiding this comment

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

Please simplify this code:

Suggested change
foreach ($roles as $role) {
$isRole[$role] = true;
}
$isRole = array_flip($rules);

Copy link
Member Author

Choose a reason for hiding this comment

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

That‘s wonderful😲.

src/Enforcer.php Outdated
*
* @return array
*/
public function removeDumplicatePermissions(array $permissions): array
Copy link
Member

Choose a reason for hiding this comment

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

Please define it as a private function.

@Dobmod Dobmod force-pushed the feature-more-api-1.0 branch 2 times, most recently from bb66a6f to 4762fd6 Compare August 18, 2024 09:54
@Dobmod Dobmod force-pushed the feature-more-api-1.0 branch from 4762fd6 to 1a1e389 Compare August 18, 2024 10:03
@Dobmod Dobmod requested a review from leeqvip August 18, 2024 10:06
@Dobmod
Copy link
Member Author

Dobmod commented Aug 18, 2024

I made changes, please review.

@leeqvip leeqvip merged commit 6f62011 into php-casbin:master Aug 18, 2024
@leeqvip
Copy link
Member

leeqvip commented Aug 18, 2024

🎉 This issue has been resolved in version 3.24.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants