Skip to content

Commit 90c898c

Browse files
committed
Refactor execute permission checks in Is_execute_allowed function for clarity
1 parent da83149 commit 90c898c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Modules/Executable/src/lib.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,18 @@ fn Is_execute_allowed(Statistics: &Statistics_type, User: User_identifier_type)
2323
}
2424

2525
// - Check if the user is the owner and has the execute permission
26-
let Is_root = User == Users::User_identifier_type::Root;
27-
28-
if (Statistics.Get_user() == User || Is_root)
29-
&& Statistics.Get_permissions().Get_user().Get_execute()
30-
{
26+
if User == User_identifier_type::Root {
27+
return true;
28+
}
29+
if (Statistics.Get_user() == User) && Statistics.Get_permissions().Get_user().Get_execute() {
3130
return true;
3231
}
3332

3433
// - Check if the user is in the group
3534
let Is_in_group = Users::Get_instance().Is_in_group(User, Statistics.Get_group());
3635

3736
// - Check if the user is in the group
38-
if (Is_in_group || Is_root) && Statistics.Get_permissions().Get_group().Get_execute() {
37+
if (Is_in_group) && Statistics.Get_permissions().Get_group().Get_execute() {
3938
return true;
4039
}
4140

0 commit comments

Comments
 (0)