You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/02/07 16:13:02 UTC

svn commit: r1565673 - in /isis/site/trunk/content: applib-guide/reference/Security.md documentation.md

Author: danhaywood
Date: Fri Feb  7 15:13:01 2014
New Revision: 1565673

URL: http://svn.apache.org/r1565673
Log:
isis services

Modified:
    isis/site/trunk/content/applib-guide/reference/Security.md
    isis/site/trunk/content/documentation.md

Modified: isis/site/trunk/content/applib-guide/reference/Security.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/applib-guide/reference/Security.md?rev=1565673&r1=1565672&r2=1565673&view=diff
==============================================================================
--- isis/site/trunk/content/applib-guide/reference/Security.md (original)
+++ isis/site/trunk/content/applib-guide/reference/Security.md Fri Feb  7 15:13:01 2014
@@ -9,21 +9,29 @@ representation of their user and roles u
 This allows the application to inspect and act upon those details if
 required.
 
+These can be obtained from the `DomainObjectContainer`:
+
+    final UserMemento user = container.getUser();
+
 The user details are captured in the
 `org.apache.isis.applib.security.UserMemento` class ("memento" because it
-is a snapshot of their credentials at the point of logging on). The
-`UserMemento` class defines the following properties:
+is a snapshot of their credentials at the point of logging on). 
+
+The roles of the user can be obtained in turn:
+
+    final List<RoleMemento> roles = user.getRoles();
+
+Both `UserMemento` and `RoleMemento` are defined in Isis applib.
+
 
--   `name` (a `String`)
+### `BackgroundService`s and `CommandContext
 
--   collection of roles (as `RoleMemento`)
+If using the [BackgroundService](../../core/services/background-service.html), then it is possible to persist commands that will execute corresponding actions in the background (for example under the control of a scheduler).
 
-The `org.apache.isis.applib.security.RoleMemento` class in turn defines
-two properties:
+In this situation, the `user` obtained from `DomainObjectContainer` will be that of the scheduler process, which may not be what you want.
 
--   `name` (a `String`)
+However, the creator of the background `Command` (the effective user, if you like), *can* be obtained from the `CommandContext` service, using:
 
--   `description` (a `String`)
+    final String userName = commandContext.getCommand().getUser()
 
-To obtain the current user, the application can call
-`DomainObjectContainer#getUser()`. 
+> *Note*: At the time of writing, the roles of the effective user are not captured. 
\ No newline at end of file

Modified: isis/site/trunk/content/documentation.md
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/documentation.md?rev=1565673&r1=1565672&r2=1565673&view=diff
==============================================================================
--- isis/site/trunk/content/documentation.md (original)
+++ isis/site/trunk/content/documentation.md Fri Feb  7 15:13:01 2014
@@ -317,24 +317,25 @@ For both:
 
 ####  Reference
 
+
+}
+
+{col-md-4
+
 * [Recognized Methods and Prefixes](./applib-guide/reference/Recognized-Methods-and-Prefixes.html)
 * [Recognized Annotations](./applib-guide/reference/recognized-annotations/about.html)
 * [Lifecycle callbacks](./applib-guide/how-tos/how-to-07-070-How-to-hook-into-the-object-lifecycle-using-callbacks.html)
+* [Applib utility classes](applib-guide/reference/Utility.html)
 
 }
 
 {col-md-4
 
+
 #### Supporting features
 
 * [Security](./applib-guide/reference/Security.html)
 * [Applib Events](./applib-guide/reference/Event.html)
-* [Applib utility classes](applib-guide/reference/Utility.html)
-
-}
-
-{col-md-4
-
 
 #### Customisation