You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com> on 2014/12/07 12:19:41 UTC

Programmatically hide, disable or validate for services and objects

Hi to all.

Is there a way to hide an object service programmatically (i.e., using a hide() method) ?

The only way I know is the @Hidden annotation.

Same way, both them could be disabled (on Services it would mean all actions would be disabled).

And also, for objects they could be programmatically validated.

It could be also useful for per-instance security.


Is it currently available? 
If not, could it be a good idea to create a facet for hide(), disable(), validate() methods ?


Thanks,

Oscar




Re: Programmatically hide, disable or validate for services and objects

Posted by GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>.
Thanks, Dan and Jeroen.

The proposed solution is enough for my requirements.

But I've also just noticed these links for hiding [1]  and disabling [2] all members ...

I've also verified that [1] works not only for Domain Entities, but also for Services (not showing their actions as UI menus), so it fulfills my requirements with a simpler solution.

Regards,

Oscar

[1] http://isis.apache.org/more-advanced-topics/how-to-02-040-How-to-specify-that-none-of-an-object's-members-is-visible.html
[2] http://isis.apache.org/more-advanced-topics/how-to-02-080-How-to-specify-that-none-of-an-object's-members-can-be-modified-or-invoked.html




> El 8/12/2014, a las 8:41, Dan Haywood <da...@haywood-associates.co.uk> escribió:
> 
> On 7 December 2014 at 11:19, GESCONSULTOR - Óscar Bou <
> o.bou@gesconsultor.com> wrote:
> 
>> Hi to all.
>> 
>> Is there a way to hide an object service programmatically (i.e., using a
>> hide() method) ?
>> 
>> The only way I know is the @Hidden annotation.
>> 
>> 
> There isn't currently any built-in method for this, no.  You can find this
> out by looking for facets that implement HidingInteractionAdvisor.
> 
> But on way the requirement can be supported is using the event bus, eg
> adding this to the SimpleObjects service will hide the service (because all
> of its actions are hidden):
> 
> 
>    @Programmatic
>    @PostConstruct
>    public void postConstruct() {
>        eventBusService.register(this);
>    }
> 
>    @Programmatic
>    @Subscribe
>    public void on(final ActionInteractionEvent<?> ev) {
>        switch(ev.getPhase()) {
>            case HIDE:
> 
> if(SimpleObjects.class.isAssignableFrom(ev.getSource().getClass())) {
>                    ev.hide();
>                }
>                break;
>        }
>    }
> 
>    @javax.inject.Inject
>    private EventBusService eventBusService;
> 
> 
> 
> Given we have such flexible support, I'm not certain we need any additional
> special supporting methods.  What do you think?
> 
> HTH
> Dan
> 
> 
> 
> 
>> Same way, both them could be disabled (on Services it would mean all
>> actions would be disabled).
>> 
>> And also, for objects they could be programmatically validated.
>> 
>> It could be also useful for per-instance security.
>> 
>> 
>> Is it currently available?
>> If not, could it be a good idea to create a facet for hide(), disable(),
>> validate() methods ?
>> 
> 
>> Thanks,
>> 
>> Oscar
>> 
>> 
>> 
>> 


Óscar Bou Bou
Responsable de Producto
Auditor Jefe de Certificación ISO 27001 en BSI
CISA, CRISC, APMG ISO 20000, ITIL-F

   902 900 231 / 620 267 520
   http://www.twitter.com/oscarbou <http://www.twitter.com/oscarbou>

   http://es.linkedin.com/in/oscarbou <http://es.linkedin.com/in/oscarbou>

   http://www.GesConsultor.com <http://www.gesconsultor.com/> 




Este mensaje y los ficheros anexos son confidenciales. Los mismos contienen información reservada que no puede ser difundida. Si usted ha recibido este correo por error, tenga la amabilidad de eliminarlo de su sistema y avisar al remitente mediante reenvío a su dirección electrónica; no deberá copiar el mensaje ni divulgar su contenido a ninguna persona.
Su dirección de correo electrónico junto a sus datos personales constan en un fichero titularidad de Gesdatos Software, S.L. cuya finalidad es la de mantener el contacto con Ud. Si quiere saber de qué información disponemos de Ud., modificarla, y en su caso, cancelarla, puede hacerlo enviando un escrito al efecto, acompañado de una fotocopia de su D.N.I. a la siguiente dirección: Gesdatos Software, S.L. , Paseo de la Castellana, 153 bajo - 28046 (Madrid), y Avda. Cortes Valencianas num. 50, 1ºC - 46015 (Valencia). Asimismo, es su responsabilidad comprobar que este mensaje o sus archivos adjuntos no contengan virus informáticos, y en caso que los tuvieran eliminarlos.






Re: Programmatically hide, disable or validate for services and objects

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, Dec 8, 2014 at 8:41 AM, Dan Haywood <da...@haywood-associates.co.uk>
wrote:

> On 7 December 2014 at 11:19, GESCONSULTOR - Óscar Bou <
> o.bou@gesconsultor.com> wrote:
>
> > Hi to all.
> >
> > Is there a way to hide an object service programmatically (i.e., using a
> > hide() method) ?
> >
> > The only way I know is the @Hidden annotation.
> >
> >
> There isn't currently any built-in method for this, no.  You can find this
> out by looking for facets that implement HidingInteractionAdvisor.
>
> But on way the requirement can be supported is using the event bus, eg
> adding this to the SimpleObjects service will hide the service (because all
> of its actions are hidden):
>
>
>     @Programmatic
>     @PostConstruct
>     public void postConstruct() {
>         eventBusService.register(this);
>     }
>
>     @Programmatic
>     @Subscribe
>     public void on(final ActionInteractionEvent<?> ev) {
>         switch(ev.getPhase()) {
>             case HIDE:
>
> if(SimpleObjects.class.isAssignableFrom(ev.getSource().getClass())) {
>                     ev.hide();
>                 }
>                 break;
>         }
>     }
>
>     @javax.inject.Inject
>     private EventBusService eventBusService;
>
>
>
> Given we have such flexible support, I'm not certain we need any additional
> special supporting methods.  What do you think?
>

I believe another user recently asked about the same functionality. Or at
least I understood his/her question to be the same ...
Anyway, I think the code above is indeed very flexible and useful, and we
have to add it to our documentation.
I haven't read any docu about EventBusService yet, but I haven't seen
anything like this in the hide/disable/validate related pages.
I'll add this example to the documentation in the next days unless someone
does it before me.


>
> HTH
> Dan
>
>
>
>
> > Same way, both them could be disabled (on Services it would mean all
> > actions would be disabled).
> >
> > And also, for objects they could be programmatically validated.
> >
> > It could be also useful for per-instance security.
> >
> >
> > Is it currently available?
> > If not, could it be a good idea to create a facet for hide(), disable(),
> > validate() methods ?
> >
>
> > Thanks,
> >
> > Oscar
> >
> >
> >
> >
>

Re: Programmatically hide, disable or validate for services and objects

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
On 7 December 2014 at 11:19, GESCONSULTOR - Óscar Bou <
o.bou@gesconsultor.com> wrote:

> Hi to all.
>
> Is there a way to hide an object service programmatically (i.e., using a
> hide() method) ?
>
> The only way I know is the @Hidden annotation.
>
>
There isn't currently any built-in method for this, no.  You can find this
out by looking for facets that implement HidingInteractionAdvisor.

But on way the requirement can be supported is using the event bus, eg
adding this to the SimpleObjects service will hide the service (because all
of its actions are hidden):


    @Programmatic
    @PostConstruct
    public void postConstruct() {
        eventBusService.register(this);
    }

    @Programmatic
    @Subscribe
    public void on(final ActionInteractionEvent<?> ev) {
        switch(ev.getPhase()) {
            case HIDE:

if(SimpleObjects.class.isAssignableFrom(ev.getSource().getClass())) {
                    ev.hide();
                }
                break;
        }
    }

    @javax.inject.Inject
    private EventBusService eventBusService;



Given we have such flexible support, I'm not certain we need any additional
special supporting methods.  What do you think?

HTH
Dan




> Same way, both them could be disabled (on Services it would mean all
> actions would be disabled).
>
> And also, for objects they could be programmatically validated.
>
> It could be also useful for per-instance security.
>
>
> Is it currently available?
> If not, could it be a good idea to create a facet for hide(), disable(),
> validate() methods ?
>

> Thanks,
>
> Oscar
>
>
>
>

Re: Programmatically hide, disable or validate for services and objects

Posted by Jeroen van der Wal <je...@stromboli.it>.
Hi Oscar,

There's a boolean hidden() [1] method available which can be used to hide
all members I but have never used that. If I need to hide services on a
user level I use the Isisaddons security module [2].

There's a String validate() method available for instance validation, have
it return null when valid.

A String disabled() method should be available according to JIRA [3] but I
pretty sure that it doesn't since I've addressed a similar ticket [4]. I
use @Immutable to disable all members.

HTH

Cheers,

Jeroen

[1]
http://isis.apache.org/more-advanced-topics/how-to-02-040-How-to-specify-that-none-of-an-object's-members-is-visible.html
[2] https://github.com/isisaddons/isis-module-security
[3] https://issues.apache.org/jira/browse/ISIS-142
[4] https://issues.apache.org/jira/browse/ISIS-454

On Sun, Dec 7, 2014 at 12:19 PM, GESCONSULTOR - Óscar Bou <
o.bou@gesconsultor.com> wrote:

> Hi to all.
>
> Is there a way to hide an object service programmatically (i.e., using a
> hide() method) ?
>
> The only way I know is the @Hidden annotation.
>
> Same way, both them could be disabled (on Services it would mean all
> actions would be disabled).
>
> And also, for objects they could be programmatically validated.
>
> It could be also useful for per-instance security.
>
>
> Is it currently available?
> If not, could it be a good idea to create a facet for hide(), disable(),
> validate() methods ?
>
>
> Thanks,
>
> Oscar
>
>
>
>