-
Notifications
You must be signed in to change notification settings - Fork 283
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
Allow setting of server default values for member expiry days #2840
Allow setting of server default values for member expiry days #2840
Conversation
Signed-off-by: takumats <[email protected]>
Signed-off-by: takumats <[email protected]>
} | ||
|
||
public MemberDueDays(Domain domain, Group group) { | ||
|
||
// for groups we only have user and service members | ||
// groups cannot include other groups | ||
|
||
Integer domainUserDays = domain.getMemberExpiryDays(); | ||
Integer domainServiceDays = domain.getServiceExpiryDays(); | ||
Integer domainUserDays = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we remove the domainUserDays and domainServiceDays value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this is a mistake. I have restored it.
servers/zms/conf/zms.properties
Outdated
# This property specifies the maximum expiry duration in days for user/service/group. | ||
# The value must be an integer, and the default value is 0. | ||
# If set to 0, it indicates that there is no expiry limit. | ||
#athenz.zms.default_user_expiry_days=0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's rename these three variables to be athenz.zms.default_max_... (add the max_ component). default value indicates that we'll set this if no value is specified but here we're doing 2 things: first if no value is set, we default to this value and second, if a value is specified then we do not allow the value to be bigger than this (which is max part and not necessarily default).
|
||
public class MemberDueDays { | ||
|
||
private static final int DEFAULT_USER_EXPIRY = Integer.parseInt(System.getProperty(ZMSConsts.ZMS_PROP_DEFAULT_USER_EXPIRY, "0")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. let's name these DEFAULT_MAX_USER_EXPIRY, etc to correctly indicate the max aspect of the value.
@@ -449,7 +449,7 @@ public static boolean metaValueChanged(Object domainValue, Object metaValue) { | |||
return metaValue != null && !metaValue.equals(domainValue); | |||
} | |||
|
|||
public static long configuredDueDateMillis(Integer domainDueDateDays, Integer roleDueDateDays) { | |||
public static long configuredDueDateMillis(Integer serverDefaultDueDateDays, Integer domainDueDateDays, Integer roleDueDateDays) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we have serverDefaultDueDateDays (should also be called serverDefaultMaxDueDateDays) set as Integer? It's int so we should define the function as such and it also eliminates the boxing and unnecessary null check later.
@@ -459,6 +459,13 @@ public static long configuredDueDateMillis(Integer domainDueDateDays, Integer ro | |||
} else if (domainDueDateDays != null && domainDueDateDays > 0) { | |||
expiryDays = domainDueDateDays; | |||
} | |||
|
|||
if (serverDefaultDueDateDays != null && serverDefaultDueDateDays > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
once serverDefaultMaxDueDateDays is defined as int, the null check is not necessary here
@@ -4820,6 +4820,9 @@ public DomainRoleMembers getOverdueReview(ResourceContext ctx, String domainName | |||
} | |||
|
|||
Timestamp getMemberDueDate(long cfgDueDateMillis, Timestamp memberDueDate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please update the testGetMemberDueDate unit test case to include the cfgDueDateMillis == 0 case.
22b0e52
to
5796feb
Compare
Signed-off-by: Takuya Matsumoto <[email protected]>
5796feb
to
e0f8fa7
Compare
thank you. Addressed your feedback. |
Thanks @TakuyaMatsu |
Description
This PR adds parameters to configure the maximum expiry duration for Members in Athenz ZMS.
The maximum expiry duration can be set individually for Users, Services, and Groups using the following properties:
athenz.zms.default_user_expiry_days
: Applies the maximum expiry duration for all user members.athenz.zms.default_service_expiry_days
: Applies the maximum expiry duration for all service members.athenz.zms.default_group_expiry_days
: Applies the maximum expiry duration for all group members.The default value is 0, which means no expiry is enforced unless explicitly configured.
Contribution Checklist:
Attach Screenshots (Optional)