54 | | As a rule of thumb: Whenever you pass the ''ClientState''-Object into a dms.*-call, all necessary ACL- and Workspace-Assignments should be set automatically by DeepaMehta. This happens because the information which "User" is currrently active in which "Workspace" is part of the Session-Cookie. |
| 54 | As a rule of thumb: Whenever you pass the ''ClientState''-Object into a dms.*-call, the Workspace-Assignment will be set automatically by DeepaMehta. This happens because the information which "User" is currrently active in which "Workspace" is part of the Session-Cookie. |
| 55 | |
| 56 | If ACL-Settings are set correctly depends on the availability of a "HttpSession", resp. if the ACL-Module knows who's the currently logged in user. The latter is never the case if your server-side methods are do not have a "HttpRequest"-Scope (e.g. in a Thread or when just embedding the DeepaMehtaService in your Java-Application. In that case, you' will have to take care of setting ACLEntries and a Workspace-Assignments for all the topics/assocs you create manually. |
| 57 | |
| 58 | Example given: |
| 59 | {{{ |
| 60 | private Topic setDefaultMoodleAdminACLEntries(Topic item) { |
| 61 | // Let's repair broken/missing ACL-Entries |
| 62 | ACLEntry writeEntry = new ACLEntry(Operation.WRITE, UserRole.CREATOR, UserRole.OWNER); |
| 63 | aclService.setACL(item, new AccessControlList(writeEntry)); |
| 64 | aclService.setCreator(item, USERNAME_OF_SETTINGS_ADMINISTRATOR); // which resolves to "admin" in this case |
| 65 | aclService.setOwner(item, USERNAME_OF_SETTINGS_ADMINISTRATOR); // which resolves to "admin" in this case |
| 66 | return item; |
| 67 | } |
| 68 | }}} |
| 69 | |
| 96 | |
| 97 | === Introducing a shared workspace and set up your topics to editable by all members of this shared workspace === |
| 98 | |
| 99 | A proper workspace assignment in DeepaMehta involves the "Username"-Topic (and not the "User Account"-Topic) to be the: |
| 100 | |
| 101 | {{{ |
| 102 | "Username" (Parent) <- "Aggregation" -> (Child) "My Workspace" |
| 103 | }}} |
| 104 | |
| 105 | Furthermore, the topics to be edited by all "Members" of "My Workspace", should be set up to match at least the following ACL: |
| 106 | |
| 107 | {{{ |
| 108 | ACLEntry writeList = new ACLEntry(Operation.WRITE, UserRole.MEMBER, UserRole.CREATOR, UserRole.OWNER); |
| 109 | }}} |