You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by james agada <ok...@gmail.com> on 2013/10/15 18:01:54 UTC
Allow only the creator of a record to edit it
I want to allow only the creator of a record to be the one able to do it.
Any ideas?
Re: Allow only the creator of a record to edit it
Posted by james agada <ok...@gmail.com>.
Great. This works.
On Tue, Oct 15, 2013 at 5:58 PM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:
> When you say methods, I think you mean what Isis calls actions (as opposed
> to the getter/setter methods that represent properties and collections).
>
> If so, the yes.
>
> Use the Identifier.Type enum to distinguish which sort of member
> (property/collection/action) you are protecting.
>
> Or, if you want more fine-grained control, use the regular disableXxx() for
> each 'xxx' member, eg:
>
> public String getFirstName() { ... }
> public void setFirstName(String fn) { ... }
> public String disableFirstName() { return owner()? null: "oh no you
> don't!"; }
>
> private boolean owner() { return
> getCreatedBy().equals(container.getUserName());
>
>
> Dan
>
>
>
> On 15 October 2013 17:53, james agada <ok...@gmail.com> wrote:
>
> > Thanks. If I had methods, will this also apply to them ie I have a method
> > like "Process" that appears on the menu when the entity is shown. Can I
> use
> > the same approach to disable it?
> >
> >
> > On Tue, Oct 15, 2013 at 5:10 PM, Dan Haywood
> > <da...@haywood-associates.co.uk>wrote:
> >
> > > something like:
> > >
> > > public class SomeClass {
> > >
> > > private String createdBy;
> > > ...
> > >
> > > public String disabled(Identifier.Type type) {
> > > return createdBy.equals(container.getUserName())? null: "Only
> the
> > > creator can modify this object";
> > > }
> > > }
> > >
> > > HTH
> > > Dan
> > >
> > >
> > >
> > > On 15 October 2013 17:01, james agada <ok...@gmail.com> wrote:
> > >
> > > > I want to allow only the creator of a record to be the one able to do
> > it.
> > > > Any ideas?
> > > >
> > >
> >
>
Re: Allow only the creator of a record to edit it
Posted by james agada <ok...@gmail.com>.
Yea Action. Ok Thanks.
On Tue, Oct 15, 2013 at 5:58 PM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:
> When you say methods, I think you mean what Isis calls actions (as opposed
> to the getter/setter methods that represent properties and collections).
>
> If so, the yes.
>
> Use the Identifier.Type enum to distinguish which sort of member
> (property/collection/action) you are protecting.
>
> Or, if you want more fine-grained control, use the regular disableXxx() for
> each 'xxx' member, eg:
>
> public String getFirstName() { ... }
> public void setFirstName(String fn) { ... }
> public String disableFirstName() { return owner()? null: "oh no you
> don't!"; }
>
> private boolean owner() { return
> getCreatedBy().equals(container.getUserName());
>
>
> Dan
>
>
>
> On 15 October 2013 17:53, james agada <ok...@gmail.com> wrote:
>
> > Thanks. If I had methods, will this also apply to them ie I have a method
> > like "Process" that appears on the menu when the entity is shown. Can I
> use
> > the same approach to disable it?
> >
> >
> > On Tue, Oct 15, 2013 at 5:10 PM, Dan Haywood
> > <da...@haywood-associates.co.uk>wrote:
> >
> > > something like:
> > >
> > > public class SomeClass {
> > >
> > > private String createdBy;
> > > ...
> > >
> > > public String disabled(Identifier.Type type) {
> > > return createdBy.equals(container.getUserName())? null: "Only
> the
> > > creator can modify this object";
> > > }
> > > }
> > >
> > > HTH
> > > Dan
> > >
> > >
> > >
> > > On 15 October 2013 17:01, james agada <ok...@gmail.com> wrote:
> > >
> > > > I want to allow only the creator of a record to be the one able to do
> > it.
> > > > Any ideas?
> > > >
> > >
> >
>
Re: Allow only the creator of a record to edit it
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
When you say methods, I think you mean what Isis calls actions (as opposed
to the getter/setter methods that represent properties and collections).
If so, the yes.
Use the Identifier.Type enum to distinguish which sort of member
(property/collection/action) you are protecting.
Or, if you want more fine-grained control, use the regular disableXxx() for
each 'xxx' member, eg:
public String getFirstName() { ... }
public void setFirstName(String fn) { ... }
public String disableFirstName() { return owner()? null: "oh no you
don't!"; }
private boolean owner() { return
getCreatedBy().equals(container.getUserName());
Dan
On 15 October 2013 17:53, james agada <ok...@gmail.com> wrote:
> Thanks. If I had methods, will this also apply to them ie I have a method
> like "Process" that appears on the menu when the entity is shown. Can I use
> the same approach to disable it?
>
>
> On Tue, Oct 15, 2013 at 5:10 PM, Dan Haywood
> <da...@haywood-associates.co.uk>wrote:
>
> > something like:
> >
> > public class SomeClass {
> >
> > private String createdBy;
> > ...
> >
> > public String disabled(Identifier.Type type) {
> > return createdBy.equals(container.getUserName())? null: "Only the
> > creator can modify this object";
> > }
> > }
> >
> > HTH
> > Dan
> >
> >
> >
> > On 15 October 2013 17:01, james agada <ok...@gmail.com> wrote:
> >
> > > I want to allow only the creator of a record to be the one able to do
> it.
> > > Any ideas?
> > >
> >
>
Re: Allow only the creator of a record to edit it
Posted by james agada <ok...@gmail.com>.
Thanks. If I had methods, will this also apply to them ie I have a method
like "Process" that appears on the menu when the entity is shown. Can I use
the same approach to disable it?
On Tue, Oct 15, 2013 at 5:10 PM, Dan Haywood
<da...@haywood-associates.co.uk>wrote:
> something like:
>
> public class SomeClass {
>
> private String createdBy;
> ...
>
> public String disabled(Identifier.Type type) {
> return createdBy.equals(container.getUserName())? null: "Only the
> creator can modify this object";
> }
> }
>
> HTH
> Dan
>
>
>
> On 15 October 2013 17:01, james agada <ok...@gmail.com> wrote:
>
> > I want to allow only the creator of a record to be the one able to do it.
> > Any ideas?
> >
>
Re: Allow only the creator of a record to edit it
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
something like:
public class SomeClass {
private String createdBy;
...
public String disabled(Identifier.Type type) {
return createdBy.equals(container.getUserName())? null: "Only the
creator can modify this object";
}
}
HTH
Dan
On 15 October 2013 17:01, james agada <ok...@gmail.com> wrote:
> I want to allow only the creator of a record to be the one able to do it.
> Any ideas?
>