Skip to content

Commit

Permalink
Merge branch 'fix/VOMS-706' into develop
Browse files Browse the repository at this point in the history
* fix/VOMS-706:
  Add ability to disable member expiration warnings
  • Loading branch information
andreaceccanti committed Feb 10, 2016
2 parents cd9dd08 + 0224ef4 commit 91faf00
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ def setup_cl_options():
membership_opt_group.add_option("--preserve-expired-members", action="store_true", dest="preserve_expired_members", help="Do not suspend users whose membership has expired.", default=False)
membership_opt_group.add_option("--preserve-aup-failing-members", action="store_true", dest="preserve_aup_failing_members", help="Do not suspend users that fail to sign the AUP in time.", default=False)
membership_opt_group.add_option("--disable-membership-end-time", action="store_true", dest="disable_membership_end_time", help="Disable membership end time checks completely.", default=False)

membership_opt_group.add_option("--disable-membership-expiration-warnings", action="store_true", dest="disable_membership_expiration_warning", help="Disable membership expiration warnings.", default=False)

membership_opt_group.add_option("--membership-default-lifetime", type="int", dest="membership_default_lifetime", help="Default VO membership lifetime duration (in months).", metavar="MONTHS", default=12)

Expand Down
6 changes: 6 additions & 0 deletions voms-admin-server/resources/templates/service.properties
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ voms.membership.default_lifetime = $membership_default_lifetime
## this configuration option.
voms.membership.expiration_warning_period = $membership_expiration_warning_period

## Disable membership expiration warning notifications.
## When this flag is set to true, VOMS admin does not send notifications
## to VO Admins about users about to expired in the time period defined by the
## voms.membership.expiration_warning_period configuration property.
voms.membership.disable_expiration_warning = $disable_membership_expiration_warning

## Membership expiration grace period (in days). In the grace period
## the user will be maintained active even if its membership has expired.
## Note that this option has no effect if the voms.preserve_expired_members
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public interface VOMSConfigurationConstants {
*/
public static final String DEFAULT_MEMBERSHIP_LIFETIME = "voms.membership.default_lifetime";
public static final String MEMBERSHIP_CHECK_PERIOD = "voms.task.membership_check.period";
public static final String DISABLE_MEMBERSHIP_EXPIRATION_WARNING="voms.membership.disable_expiration_warning";
public static final String MEMBERSHIP_EXPIRATION_WARNING_PERIOD = "voms.membership.expiration_warning_period";
public static final String MEMBERSHIP_EXPIRATION_WARNING_PERIOD_DEFAULT_VALUE = "15";
public static final String MEMBERSHIP_EXPIRATION_GRACE_PERIOD = "voms.membership.expiration_grace_period";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DefaultMembershipCheckBehaviour extends
AbstractMembershipCheckBehaviour {
public class DefaultMembershipCheckBehaviour
extends AbstractMembershipCheckBehaviour {

public static final Logger log = LoggerFactory
.getLogger(DefaultMembershipCheckBehaviour.class);
Expand All @@ -50,17 +50,14 @@ protected void validateMembershipCheckConfiguration() {

boolean disableMembershipEndTime = conf.getBoolean(
VOMSConfigurationConstants.DISABLE_MEMBERSHIP_END_TIME, false);
boolean preserveExpiredMembers = conf.getBoolean(
VOMSConfigurationConstants.PRESERVE_EXPIRED_MEMBERS, false);


boolean preserveExpiredMembers = conf
.getBoolean(VOMSConfigurationConstants.PRESERVE_EXPIRED_MEMBERS, false);

if (disableMembershipEndTime && preserveExpiredMembers) {
log
.error(
"The {} and {} configuration properties cannot be true at the same time",
new String[] {
VOMSConfigurationConstants.DISABLE_MEMBERSHIP_END_TIME,
VOMSConfigurationConstants.PRESERVE_EXPIRED_MEMBERS });
log.error(
"The {} and {} configuration properties cannot be true at the same time",
new String[] { VOMSConfigurationConstants.DISABLE_MEMBERSHIP_END_TIME,
VOMSConfigurationConstants.PRESERVE_EXPIRED_MEMBERS });

log.warn("Setting {} to false",
VOMSConfigurationConstants.DISABLE_MEMBERSHIP_END_TIME);
Expand All @@ -80,31 +77,41 @@ public DefaultMembershipCheckBehaviour() {
VOMSConfigurationConstants.PRESERVE_AUP_FAILING_MEMBERS, false);

aupFMLookupStrategy = new DefaultAUPFailingMembersLookupStrategy();
if (preserveAUPFailingMembers){

if (preserveAUPFailingMembers) {
log.warn("Members that fail to sign the VO AUP in time will NOT be "
+ "automatically suspended, as requested by the configuration.");

aupFailingMembersStrategy = new NoOpAUPFailingMembersStrategy();
}else {
} else {
aupFailingMembersStrategy = new SuspendAUPFailingMembersStrategy();
}


boolean disableMembershipEndTime = conf.getBoolean(
VOMSConfigurationConstants.DISABLE_MEMBERSHIP_END_TIME, false);
boolean preserveExpiredMembers = conf.getBoolean(
VOMSConfigurationConstants.PRESERVE_EXPIRED_MEMBERS, false);
boolean preserveExpiredMembers = conf
.getBoolean(VOMSConfigurationConstants.PRESERVE_EXPIRED_MEMBERS, false);

int notificationInterval = VOMSConfiguration.instance().getInt(
VOMSConfigurationConstants.NOTIFICATION_WARNING_RESEND_PERIOD, 1);
int notificationInterval = VOMSConfiguration.instance()
.getInt(VOMSConfigurationConstants.NOTIFICATION_WARNING_RESEND_PERIOD, 1);

final boolean disableExpiringMembersNotification = conf.getBoolean(
VOMSConfigurationConstants.DISABLE_MEMBERSHIP_EXPIRATION_WARNING, false);

HandleExpiringMembersStrategy ems = new SendWarningAboutExpiringMembersStrategy();

if (disableExpiringMembersNotification) {
ems = new NoOpHandleExpiringMembersStrategy();
log.warn(
"Disabling expiring members warnings as requested by configuration.");
}

if (disableMembershipEndTime) {

IgnoreMembershipEndTimeStrategy s = new IgnoreMembershipEndTimeStrategy();

log
.warn("The membership end time will be IGNORED by the VOMS membership check behaviour as requested by configuration.");
log.warn(
"The membership end time will be IGNORED by the VOMS membership check behaviour as requested by configuration.");

expiredMembersLookupStrategy = s;
expiredMembersStrategy = s;
Expand All @@ -113,15 +120,15 @@ public DefaultMembershipCheckBehaviour() {

} else if (preserveExpiredMembers) {

log
.warn("Expired members will NOT be suspended as requested. Administrators will be notified of expired members via email.");
log.warn(
"Expired members will NOT be suspended as requested. Administrators will be notified of expired members via email.");
expiredMembersStrategy = new PreserveExpiredMembersStrategy(
notificationInterval);

expiredMembersLookupStrategy = new DefaultExpiredMembersLookupStrategy();
expiringMembersLookupStrategy = new DefaultExpiringMembersLookupStrategy();

expiringMembersStrategy = new SendWarningAboutExpiringMembersStrategy();
expiringMembersStrategy = ems;

} else {

Expand All @@ -140,7 +147,7 @@ public DefaultMembershipCheckBehaviour() {
expiredMembersStrategy = new GracePeriodExpiredMembersStrategy(
gracePeriodInDays, notificationInterval);

expiringMembersStrategy = new SendWarningAboutExpiringMembersStrategy();
expiringMembersStrategy = ems;
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) Istituto Nazionale di Fisica Nucleare (INFN). 2006-2015
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.glite.security.voms.admin.core.validation.strategies.impl;

import java.util.List;

import org.glite.security.voms.admin.core.validation.strategies.HandleExpiringMembersStrategy;
import org.glite.security.voms.admin.persistence.model.VOMSUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class NoOpHandleExpiringMembersStrategy
implements HandleExpiringMembersStrategy {

public static final Logger LOG = LoggerFactory
.getLogger(NoOpHandleExpiringMembersStrategy.class);

@Override
public void handleMembersAboutToExpire(List<VOMSUser> expiringMembers) {

LOG.debug("Doing nothing about members about to expire, as requested");


}

}

0 comments on commit 91faf00

Please sign in to comment.