-
Notifications
You must be signed in to change notification settings - Fork 111
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
Issue#520 explicit user group for module hide forbid tag #521
Issue#520 explicit user group for module hide forbid tag #521
Conversation
Hi Xavier, PR done, sorry for the delay. Thank you for your suggestion for I use the following test:
And of course the same apply to the set apply [expr {($user || $group || (!$notuser && !$notgroup)) &&\
($isbefore || $isafter || (![info exists before] && ![info exists\
after]))}]
|
There is something missing in your message I think. I do not see the
content of the `.modulerc` file to correctly understand your example.
Le lun. 15 janv. 2024 à 14:57, Jérémy Déchard ***@***.***> a
écrit :
… Hi Xavier,
PR done, sorry for the delay.
Thank you for your suggestion for appIyand isnearly. In fact this was my
first try 2 weeks ago and it works well only for the user/ group used in
the module-{hide,forbid,tag} command.
I use the following test:
- user alan belonging to groupA
- user bill belonging to groupB
- a .modulerc file hiding the foo application with the different
option set
- The table below sums up what we should get:
module-hide option bool user for alan bool not-user for alan wanted apply
for alan bool user for bill bool not-user for bill wanted apply for bill
--user alan 1 0 1 0 0 0
--not-user alan 0 1 1 0 0 0
And of course the same apply to the groupoption.
With:
set apply [expr {($user || $group || (!$notuser && !$notgroup)) &&\
($isbefore || $isafter || (![info exists before] && ![info exists\
after]))}]
apply=1 all the time for bill due to the ORoperator between user/groupand
notuser/notgroupbooleans. I tried different unique expressions without
success so far... There is maybe something that I don't see here...
—
Reply to this email directly, view it on GitHub
<#521 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABFTKVMRIGFSKLSKJ65E5RTYOUYWJAVCNFSM6AAAAABB3JI2PWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJSGIZDKOJYGQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
The #%Module
# Comment/Uncomment to test the different options
module-hide --user alan foo
#module-hide --not-user alan foo
#module-hide --group groupA foo
#module-hide --not-group groupA foo |
With
If we split Tcl code a bit, it may be simpler to build the accurate set user_or_group_target_defined [expr {[info exists user] || [info exists\
group]}]
set user_or_group_targeted [expr {$user || $group}]
set user_or_group_excluded [expr {$notuser || $notgroup}]
set time_frame_defined [expr {[info exists before] || [info exists after]}]
set in_time_frame [expr {!$time_frame_defined || $isbefore || $isafter}]
set apply [expr {$in_time_frame && ($user_or_group_targeted ||\
(!$user_or_group_target_defined && !$user_or_group_excluded))}] User or group exclusion should be skipped if a user or group target is defined. This code seems to work with the few examples I have tried. |
Hello Xavier, Thank you for the good catch and to break down the Tcl code! From my test
If I correct the I'll try to look into that (maybe a typo that I don't see yet) and find out a valid Regards, |
Hello Jeremy, I made an error on the definition of the set user_or_group_target_defined [expr {[info exists userlist] || [info\
exists grouplist]}] To help clarify set in_near_time_frame [expr {[info exists after] && !$isafter &&\
[getState clock_seconds] >= ($after - $nearsec)}] I think set isnearly [expr {!$apply && ($user_or_group_targeted ||\
(!$user_or_group_target_defined && !$user_or_group_excluded)) &&\
$in_near_time_frame}] Regards, |
@jdechard I am taking over this pull request. I will finish tests and documentation soon, so this change will be part of 5.4 |
Hello Xavier, Sorry to not have answer sooner (little bit busy) , your suggestions seem to work well on my test with Many thanks for you help :) Regards |
Add --group and --user options to module-hide, module-forbid and module-tag modulefile commands. When set, restriction or tag specifically applies to the list of user and/or to the list of group defined. Fixes envmodules#520
7a3ac8a
to
91b4de7
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #521 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 14 14
Lines 5123 5123
=======================================
Hits 5103 5103
Misses 20 20 ☔ View full report in Codecov by Sentry. |
Open PR to review code for explicit
user
/group
option inmodule-{hide,forbid,tag}
command (see issue here..Code review needed to not use the boolean
flag
.