001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.module.cam.document.authorization;
017    
018    import java.util.Map;
019    
020    import org.kuali.kfs.module.cam.CamsPropertyConstants;
021    import org.kuali.kfs.module.cam.businessobject.Asset;
022    import org.kuali.kfs.sys.document.authorization.FinancialSystemMaintenanceDocumentAuthorizerBase;
023    import org.kuali.rice.kns.bo.BusinessObject;
024    
025    /**
026     * AssetAuthorizer for Asset edit.
027     */
028    public class AssetGlobalAuthorizer extends FinancialSystemMaintenanceDocumentAuthorizerBase {
029        /**
030         * 
031         * @see org.kuali.rice.kns.document.authorization.MaintenanceDocumentAuthorizerBase#addRoleQualification(org.kuali.rice.kns.bo.BusinessObject, java.util.Map)
032         */
033        @Override
034        protected void addRoleQualification(BusinessObject businessObject, Map<String, String> attributes) {
035            super.addRoleQualification(businessObject, attributes);
036                    
037            //This was added so when the asset lookup page is requested, then it will check for role qualifiers and validate whether the user has access to
038            // to some asset functions like "Separate". Take a look at AssetLookupableHelperServiceImpl.getSeparateUrl(Asset asset) for more info.        
039            if (businessObject instanceof Asset) {
040                Asset asset = (Asset) businessObject;
041                attributes.put(CamsPropertyConstants.Asset.CAMPUS_CODE,asset.getCampusCode());
042            }                
043        }
044    }