/*
 *  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you 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.estatio.dscm.dom.publisher;

import java.util.List;

import org.apache.isis.applib.AbstractFactoryAndRepository;
import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
import org.apache.isis.applib.annotation.Bookmarkable;
import org.apache.isis.applib.annotation.DomainService;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.query.QueryDefault;

@DomainService
public class Publishers extends AbstractFactoryAndRepository {

    public String getId() {
        return "publisher";
    }

    public String iconName() {
        return "Publisher";
    }

    @Bookmarkable
    @ActionSemantics(Of.SAFE)
    @MemberOrder(sequence = "1")
    public List<Publisher> allPublishers() {
        return container.allInstances(Publisher.class);
    }

    // //////////////////////////////////////
    // Create (action)
    // //////////////////////////////////////

    @MemberOrder(sequence = "2")
    public Publisher newPublisher(
            final @Named("Name") String name) {
        final Publisher obj = container.newTransientInstance(Publisher.class);
        obj.setName(name);
        container.persistIfNotAlready(obj);
        return obj;
    }

    // //////////////////////////////////////
    // Injected services
    // //////////////////////////////////////

    @javax.inject.Inject
    DomainObjectContainer container;

    public Publisher findByName(String name) {
        return firstMatch(new QueryDefault<Publisher>(Publisher.class, "findByName", "name", name));
    }

}

@@ -2178,32 +2178,166 @@
 urn obj;%0A    %7D%0A%0A
+    public boolean hideNewPublisher(final String name) %7B%0A        return !getContainer().getUser().hasRole(%22.*admin_role%22);%0A    %7D%0A    %0A
     // /////////
@@ -2533,16 +2533,31 @@
 dByName(
+@Named(%22Name%22) 
 String n

Remove new publisher option for non admins