You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by bu...@apache.org on 2014/10/23 11:54:37 UTC
svn commit: r926527 - in /websites/staging/isis/trunk: cgi-bin/ content/
content/more-advanced-topics/
Author: buildbot
Date: Thu Oct 23 09:54:37 2014
New Revision: 926527
Log:
Staging update by buildbot for isis
Modified:
websites/staging/isis/trunk/cgi-bin/ (props changed)
websites/staging/isis/trunk/content/ (props changed)
websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-040-How-to-specify-that-none-of-an-object's-members-is-visible.html
websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-080-How-to-specify-that-none-of-an-object's-members-can-be-modified-or-invoked.html
Propchange: websites/staging/isis/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Oct 23 09:54:37 2014
@@ -1 +1 @@
-1633778
+1633780
Propchange: websites/staging/isis/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Oct 23 09:54:37 2014
@@ -1 +1 @@
-1633778
+1633780
Modified: websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-040-How-to-specify-that-none-of-an-object's-members-is-visible.html
==============================================================================
--- websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-040-How-to-specify-that-none-of-an-object's-members-is-visible.html (original)
+++ websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-040-How-to-specify-that-none-of-an-object's-members-is-visible.html Thu Oct 23 09:54:37 2014
@@ -434,8 +434,35 @@
}
</code></pre>
-<p>If the function returns <code>true</code>, all properties and actions will be hidden
-from the user<!--, similar to ?-->.</p>
+<p>If the function returns <code>true</code>, then the user will not be able to view the
+object's details. (In fact, for security purposes the Wicket viewer returns
+an error message that does not even indicate whether the object exists, in
+essence a "404 not found" message).</p>
+
+<h2>Examples</h2>
+
+<p>To prevent a user from accessing an object not "owned" by them, use:</p>
+
+<pre><code>public class SomeEntity {
+
+ ...
+
+ private String ownedBy;
+ public String getOwnedBy() { return ownedBy; }
+ public void setOwnedBy(String ownedBy) { this.ownedBy = ownedBy; }
+
+ public boolean hidden() {
+ return !Objects.equal(getOwnedBy(), container.getUser().getName());
+ }
+
+ @javax.inject.Inject
+ private DomainObjectContainer container;
+}
+</code></pre>
+
+<h2>See also</h2>
+
+<p>It is also possible to allow view-only access by <a href="how-to-02-080-How-to-specify-that-none-of-an-object's-members-can-be-modified-or-invoked.html">disabling all members</a>.</p>
Modified: websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-080-How-to-specify-that-none-of-an-object's-members-can-be-modified-or-invoked.html
==============================================================================
--- websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-080-How-to-specify-that-none-of-an-object's-members-can-be-modified-or-invoked.html (original)
+++ websites/staging/isis/trunk/content/more-advanced-topics/how-to-02-080-How-to-specify-that-none-of-an-object's-members-can-be-modified-or-invoked.html Thu Oct 23 09:54:37 2014
@@ -431,18 +431,16 @@ has been paid. The viewer is expected to
any sort of "edit" button.</p>
<p>To indicate that an object cannot be modified, use the
-<code>String disabled(Type type)</code> method.</p>
-
-<p>For example:</p>
+<code>String disabled(Identifier.Type type)</code> method:</p>
<pre><code>public class FeeInvoice implements Invoice {
- public String disabled(Type type){
+ public String disabled(Identifier.Type type){
...
}
}
</code></pre>
-<p>The <code>Type</code> is from org.apache.isis.applib.Identifier:</p>
+<p>where <code>Identifier.Type</code> is in `org.apache.isis.applib:</p>
<pre><code> /**
* What type of feature this identifies.
@@ -455,7 +453,40 @@ any sort of "edit" button.</p>
<p>and provides fine grain control over disabling actions and properties.</p>
<p>The return String is null if the the object (action or property) is not
-disabled, or the reason why it is disabled<!--, similar to ?-->.</p>
+disabled, or the reason why it is disabled.</p>
+
+<h2>Examples</h2>
+
+<p>To prevent a user from modifying an object not "owned" by them, use:</p>
+
+<pre><code>public class SomeEntity {
+
+ ...
+
+ private String ownedBy;
+ public String getOwnedBy() { return ownedBy; }
+ public void setOwnedBy(String ownedBy) { this.ownedBy = ownedBy; }
+
+ public String disabled(Identifier.Type type) {
+ if(Objects.equal(getOwnedBy(), container.getUser().getName())) {
+ return null;
+ }
+ return "Can't modify objects not owned by you.";
+ }
+
+ @javax.inject.Inject
+ private DomainObjectContainer container;
+}
+</code></pre>
+
+<p><div class="note">
+This does not apply to any contributed actions; they must be disabled explicitly.
+</div></p>
+
+<h2>See also</h2>
+
+<p>It is also possible to prevent the user from even viewing an object, that is
+to programmatically <a href="how-to-02-040-How-to-specify-that-none-of-an-object's-members-is-visible">hide the object</a>.</p>
<!--
See also ?.