001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019package org.apache.isis.extensions.secman.api.permission;
020
021import org.apache.isis.commons.internal.base._Strings;
022import org.apache.isis.core.metamodel.services.appfeat.ApplicationFeature;
023
024/**
025 * Named after UNIX modes (<code>chmod</code> etc), determines that nature of access (of denial of access if vetoed)
026 * to an {@link ApplicationFeature}.
027 */
028public enum ApplicationPermissionMode {
029    /**
030     * Whether the user/role can view (or is prevented from viewing) the application feature (class member).
031     *
032     * <p>
033     * The {@link ApplicationPermissionRule rule} of the
034     * {@link org.apache.isis.extensions.security.manager.jdo.dom.permission.ApplicationPermission} indicates whether access is being
035     * granted or denied.
036     * </p>
037     */
038    VIEWING,
039    /**
040     * Whether can user/role can change (or is prevented from changing) the state of the system using the application feature (class member).
041     *
042     * <p>
043     * In other words, whether they can execute (if an action, modify/clear (if a property), addTo/removeFrom
044     * (if a collection).
045     * </p>
046     *
047     * <p>
048     * The {@link ApplicationPermissionRule rule} of the
049     * {@link org.apache.isis.extensions.security.manager.jdo.dom.permission.ApplicationPermission} indicates whether access is being
050     * granted or denied.
051     * </p>
052     *
053     * <p>
054     * Note that the Wicket viewer does not at the time of writing (Isis 1.6.0) support the notion of
055     * mutable collections.  The RO viewer does, however.
056     * </p>
057     */
058    CHANGING;
059
060    @Override
061    public String toString() {
062        return _Strings.capitalize(name());
063    }
064
065}