8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * opensso/legal/CDDLv1.0.txt
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * at opensso/legal/CDDLv1.0.txt.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: AMAssignableDynamicGroupImpl.java,v 1.4 2008/06/25 05:41:19 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackage com.iplanet.am.sdk;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport java.util.Set;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.iplanet.sso.SSOException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.iplanet.sso.SSOToken;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.iplanet.sso.SSOTokenManager;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The <code>AMAssignableDynamicGroupImpl</code> class implements interface
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <code>AMGroupAssignableDynamicGroup</code>.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @deprecated As of Sun Java System Access Manager 7.1.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterclass AMAssignableDynamicGroupImpl extends AMGroupImpl implements
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster AMAssignableDynamicGroup {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster protected AMAssignableDynamicGroupImpl(SSOToken ssoToken, String DN) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster super(ssoToken, DN, ASSIGNABLE_DYNAMIC_GROUP);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Adds users to the assignable dynamic group.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param users the set of user distinguished names to be added to the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * assignable dynamic group.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException if there is an internal error in the Access
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Management Store.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException if the single sign on token is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void addUsers(Set users) throws AMException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SSOTokenManager.getInstance().validateToken(super.token);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster dsServices.modifyMemberShip(super.token, users, super.entryDN,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ASSIGNABLE_DYNAMIC_GROUP, ADD_MEMBER);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Removes users from the assignable dynamic group.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param users The set of user distinguished names to be removed from the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * assignable dynamic group.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException if there is an internal error in the Access
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Management Store.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException if the single sign on token is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void removeUsers(Set users) throws AMException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SSOTokenManager.getInstance().validateToken(super.token);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster dsServices.modifyMemberShip(super.token, users, super.entryDN,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ASSIGNABLE_DYNAMIC_GROUP, REMOVE_MEMBER);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns true if the group is subscribable.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return true if the group is subscribable.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException if there is an internal error in the Access
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Management Store.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException if the single sign on token is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public boolean isSubscribable() throws AMException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return getBooleanAttribute(SUBSCRIBABLE_ATTRIBUTE);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets subscribe-ability of the group.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param subscribable true if the group is subscribable.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException if there is an internal error in the Access
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Management Store.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException if the single sign on token is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setSubscribable(boolean subscribable) throws AMException,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster setBooleanAttribute(SUBSCRIBABLE_ATTRIBUTE, subscribable);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster store();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}