Skip to content

Commit 31743ae

Browse files
authored
Merge pull request #14 from cmu-sei/separte-comm-apps
Restructuring comm apps logic and readme
2 parents 417c0f4 + eeb60db commit 31743ae

File tree

9 files changed

+165
-148
lines changed

9 files changed

+165
-148
lines changed

README.md

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -141,30 +141,10 @@ In this section, you can configure each application individually by setting URLs
141141
#### Application Settings Overview
142142
Each application has a dedicated settings section. Expand each section to get an overview of each configurable application and its specific settings:
143143

144-
<details>
145-
<summary><strong>Keycloak:</strong> Open Source Identity and Access Management</summary>
146-
147-
If enabled, the Keycloak block will be added to the Applications block. If the user has admin privileges or is part of a group that has admin privileges, the URL provided to the user will contain the `/admin/master/console` path. For regular users, the URL provided to the user will contain the `/realms/master/account` path.
148-
149-
![Keycloak Settings](img/keycloak-settings.png)
150-
151-
- **Show Keycloak:** Show Keycloak application regardless of user permissions.
152-
- **User Account Redirect:** When enabled, redirects all users to the same page used for user account management.
153-
- **Keycloak User URL:** Specifies the Keycloak URL to which regular users are redirected. Ensure the URL includes the realm component without trailing /.
154-
- **Keycloak Admin URL:** Specifies the Keycloak URL tto which admins are redirected. Ensure the URL includes the realm component without trailing /.
155-
- **Admin Keycloak Groups:** Specify groups relevant to Keycloak for role-based permissions.
156-
157-
**Additional Configuration Requirements:**
158-
- **Moodle Client Configuration in Keycloak:** The Keycloak integration will only function correctly if the Moodle client in Keycloak has the `Service Account` configuration enabled. This setup allows the Applications block to authenticate as a service account and access Keycloak's APIs for roles and groups.
159-
- **View Roles in Keycloak:** To enable proper role-based permissions, the Keycloak client must also be configured to include `view roles` in the `Service Account Roles` section. This ensures that user roles are correctly fetched and applied for filtering and permissions management.
160-
161-
These configurations are essential to ensure seamless communication between Moodle and Keycloak for user authentication and role-based permissions.
162-
</details>
163-
164144
<details>
165145
<summary><strong>Alloy: </strong>Conducting a Simulation</summary>
166146

167-
If the required URLs are added, the Alloy block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Player application or if the user has any active views in the Player application. As a requirement, for this block to be enabled, the Player block should also be configured.
147+
If the required URLs are added, the Alloy block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Player application or if the user has any active views in the Player application. As a requirement, for this block to be enabled, the Player block should also be configured or the `Show Alloy` is checked.
168148

169149
![Alloy Settings](img/alloy-settings.png)
170150

@@ -176,7 +156,7 @@ If the required URLs are added, the Alloy block will be added to the Application
176156
<details>
177157
<summary><strong>Blueprint: </strong>Building a MSEL</summary>
178158

179-
If the required URLs are added, the Blueprint block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Blueprint application or if the user has any MSELs and the `Show All Applications` is checked.
159+
If the required URLs are added, the Blueprint block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Blueprint application or if the user has any MSELs and the `Show All Applications` is checked or the `Show Blueprint` is checked.
180160

181161
![Blueprint Settings](img/blueprint-settings.png)
182162

@@ -188,7 +168,7 @@ If the required URLs are added, the Blueprint block will be added to the Applica
188168
<details>
189169
<summary><strong>Caster: </strong>Coding a Topology</summary>
190170

191-
If the required URLs are added, the Caster block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Caster application.
171+
If the required URLs are added, the Caster block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Caster application or the `Show Caster` is checked.
192172

193173
![Caster Settings](img/caster-settings.png)
194174

@@ -200,7 +180,7 @@ If the required URLs are added, the Caster block will be added to the Applicatio
200180
<details>
201181
<summary><strong>CITE: </strong>Evaluating Threats</summary>
202182

203-
If the required URLs are added, the CITE block will be added to the Applications block. However, this block will only show if the user has admin privileges in the CITE application or if the user has an active evaluation and the `Show All Applications` is checked.
183+
If the required URLs are added, the CITE block will be added to the Applications block. However, this block will only show if the user has admin privileges in the CITE application or if the user has an active evaluation and the `Show All Applications` is checked or the `Show CITE` is checked.
204184

205185
![CITE Settings](img/cite-settings.png)
206186

@@ -222,7 +202,7 @@ If the required URL is added, the Docs block will be added to the Applications b
222202
<details>
223203
<summary><strong>Gallery: </strong>Keeping You in the Know!</summary>
224204

225-
If the required URLs are added, the Gallery block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Gallery application or if the user has an active exhibit and the `Show All Applications` is checked.
205+
If the required URLs are added, the Gallery block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Gallery application or if the user has an active exhibit and the `Show All Applications` is checked or the `Show Gallery` is checked.
226206

227207
![Gallery Settings](img/gallery-settings.png)
228208

@@ -234,7 +214,7 @@ If the required URLs are added, the Gallery block will be added to the Applicati
234214
<details>
235215
<summary><strong>Gameboard: </strong>Virtual Lab Training and Competition Platform</summary>
236216

237-
If the required URLs are added, the Gameboard block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Gameboard application or if the user has an active gamespace and the `Show All Applications` is checked or the `Enable Gameboard` is checked.
217+
If the required URLs are added, the Gameboard block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Gameboard application or if the user has an active gamespace and the `Show All Applications` is checked or the `Show Gameboard` is checked.
238218

239219
![Gameboard Settings](img/gameboard-settings-v1.png)
240220

@@ -244,10 +224,30 @@ If the required URLs are added, the Gameboard block will be added to the Applica
244224
- **Gameboard API Key:** Provide the API key needed to connect with Gameboard.
245225
</details>
246226

227+
<details>
228+
<summary><strong>Keycloak:</strong> Open Source Identity and Access Management</summary>
229+
230+
If enabled, the Keycloak block will be added to the Applications block. If the user has admin privileges or is part of a group that has admin privileges, the URL provided to the user will contain the `/admin/master/console` path. For regular users, the URL provided to the user will contain the `/realms/master/account` path.
231+
232+
![Keycloak Settings](img/keycloak-settings.png)
233+
234+
- **Show Keycloak:** Show Keycloak application regardless of user permissions.
235+
- **User Account Redirect:** When enabled, redirects all users to the same page used for user account management.
236+
- **Keycloak User URL:** Specifies the Keycloak URL to which regular users are redirected. Ensure the URL includes the realm component without trailing /.
237+
- **Keycloak Admin URL:** Specifies the Keycloak URL tto which admins are redirected. Ensure the URL includes the realm component without trailing /.
238+
- **Admin Keycloak Groups:** Specify groups relevant to Keycloak for role-based permissions.
239+
240+
**Additional Configuration Requirements:**
241+
- **Moodle Client Configuration in Keycloak:** The Keycloak integration will only function correctly if the Moodle client in Keycloak has the `Service Account` configuration enabled. This setup allows the Applications block to authenticate as a service account and access Keycloak's APIs for roles and groups.
242+
- **View Roles in Keycloak:** To enable proper role-based permissions, the Keycloak client must also be configured to include `view roles` in the `Service Account Roles` section. This ensures that user roles are correctly fetched and applied for filtering and permissions management.
243+
244+
These configurations are essential to ensure seamless communication between Moodle and Keycloak for user authentication and role-based permissions.
245+
</details>
246+
247247
<details>
248248
<summary><strong>MISP: </strong>Threat Intelligence and Sharing Platform</summary>
249249

250-
If the required URLs are added, the MISP block will be added to the Applications block. However, this block will only show if the user has admin privileges in the MISP application or if the user has an account and the `Show All Applications` is checked or the `Enable MISP` is checked.
250+
If the required URLs are added, the MISP block will be added to the Applications block. However, this block will only show if the user has admin privileges in the MISP application or if the user has an account and the `Show All Applications` is checked or the `Show MISP` is checked.
251251

252252
![MISP Settings](img/misp-settings-v1.png)
253253

@@ -259,7 +259,7 @@ If the required URLs are added, the MISP block will be added to the Applications
259259
<details>
260260
<summary><strong>Player: </strong>Designing User Interfaces</summary>
261261

262-
If the required URLs are added, the Player block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Player application or if the user has an active Player view.
262+
If the required URLs are added, the Player block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Player application or if the user has an active Player view or the `Show Player` is checked.
263263

264264
![Player Settings](img/player-settings.png)
265265

@@ -269,53 +269,51 @@ If the required URLs are added, the Player block will be added to the Applicatio
269269
</details>
270270

271271
<details>
272-
<summary><strong>Steamfitter: </strong>Crafting a Scenario</summary>
272+
<summary><strong>Rocket.Chat</strong></summary>
273273

274-
If the required URLs are added, the Steamfitter block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Steamfitter application.
274+
If the required URLs are added, the Rocket.chat block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Rocket.Chat application, the user has an account or the `Show Rocket.Chat` is checked.
275275

276-
![Steamfitter Settings](img/steamfitter-settings.png)
276+
![Rocketchat Settings](img/rocketchat-settings.png)
277277

278-
- **Show Steamfitter:** Show Steamfitter application regardless of user permissions.
279-
- **Steamfitter API:** Enter the API URL for Steamfitter.
280-
- **Steamfitter UI:** Enter the main URL for Steamfitter.
278+
- **Show Rocket.Chat:** Show Rocket.Chat application regardless of user permissions.
279+
- **Rocket.Chat API:** Enter the API URL for Rocket.chat.
280+
- **Rocket.Chat UI:** Enter the main URL for Rocket.Chat.
281+
- **Rocket.Chat Auth Token:** Enter the authentication token required for integration.
282+
- **Rocket.Chat User ID:** Specify the user ID tied to the authentication token for Rocket.Chat.
281283
</details>
282284

283285
<details>
284-
<summary><strong>TopoMojo: </strong>Virtual Lab Builder</summary>
286+
<summary><strong>Roundcube</strong></summary>
285287

286-
If the required URLs are added, the TopoMojo block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Topomojo application or the `Enable TopoMojo` is checked.
288+
For Roundcube, if the required URL is added and the `Show Roundcube` is checked, the Roundcube block will be added to the Applications block.
287289

288-
![TopoMojo Settings](img/topomojo-settings.png)
290+
![Roundcube Settings](img/roundcube-settings.png)
289291

290-
- **Show TopoMojo:** Show TopoMojo application regardless of user permissions.
291-
- **TopoMojo API:** Enter the API URL for Steamfitter.
292-
- **TopoMojo UI:** Enter the main URL for Steamfitter.
293-
- **TopoMojo API Key:** Enter the API key required for integration.
292+
- **Roundcube UI:** Enter the URL for the Roundcube application.
294293
</details>
295294

296295
<details>
297-
<summary><strong>Communication Apps</strong></summary>
296+
<summary><strong>Steamfitter: </strong>Crafting a Scenario</summary>
298297

299-
![Communication Settings](img/communication-settings.png)
298+
If the required URLs are added, the Steamfitter block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Steamfitter application or the `Show Steamfitter` is checked.
299+
![Steamfitter Settings](img/steamfitter-settings.png)
300300

301-
- **Enable Communication Apps:** Toggle visibility of all communication-related applications.
301+
- **Show Steamfitter:** Show Steamfitter application regardless of user permissions.
302+
- **Steamfitter API:** Enter the API URL for Steamfitter.
303+
- **Steamfitter UI:** Enter the main URL for Steamfitter.
302304
</details>
303305

304306
<details>
305-
<summary><strong>Rocket.Chat & Roundcube</strong></summary>
306-
307-
If the required URLs are added and the `Enable Communication Apps` is checked, the Rocket.Chat block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Rocket.Chat application or the user has an account.
308-
309-
![Roundcube Rocketchat Settings](img/roundcube-rocketchat-settings.png)
307+
<summary><strong>TopoMojo: </strong>Virtual Lab Builder</summary>
310308

311-
- **Rocket.Chat API:** Enter the API URL for Rocket.chat.
312-
- **Rocket.Chat UI:** Enter the main URL for Rocket.Chat.
313-
- **Rocket.Chat Auth Token:** Enter the authentication token required for integration.
314-
- **Rocket.Chat User ID:** Specify the user ID tied to the authentication token for Rocket.Chat.
309+
If the required URLs are added, the TopoMojo block will be added to the Applications block. However, this block will only show if the user has admin privileges in the Topomojo application or the `Show TopoMojo` is checked.
315310

316-
For Roundcube, if the required URL is added and the `Enable Communications Apps` is checked, the Roundcube block will be added to the Applications block. However, the block will only show if the user has admin privileges in the Blueprint application.
311+
![TopoMojo Settings](img/topomojo-settings.png)
317312

318-
- **Roundcube UI:** Enter the URL for the Roundcube application.
313+
- **Show TopoMojo:** Show TopoMojo application regardless of user permissions.
314+
- **TopoMojo API:** Enter the API URL for Steamfitter.
315+
- **TopoMojo UI:** Enter the main URL for Steamfitter.
316+
- **TopoMojo API Key:** Enter the API key required for integration.
319317
</details>
320318

321319
## 3. Usage Guide

block_crucible.php

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,6 @@ public function get_content() {
199199
$data->blueprint = $blueprinturl;
200200
$data->blueprintDescription = get_string('blueprintdescription', 'block_crucible');
201201
$data->blueprintLogo = $OUTPUT->image_url('crucible-icon-blueprint', 'block_crucible');
202-
203-
if ($permsblueprint && $showcomms) {
204-
$data->roundcube = get_config('block_crucible', 'roundcubeappurl');
205-
$data->roundcubeDescription = get_string('roundcubedescription', 'block_crucible');
206-
$data->roundcubeLogo = $OUTPUT->image_url('icon-roundcube', 'block_crucible');
207-
} else {
208-
debugging("Roundcube not enabled", DEBUG_DEVELOPER);
209-
}
210202
} else if ($permsblueprint == 0 && $permsblueprint != null) {
211203
debugging("No user data found on Blueprint for User: " . $userid, DEBUG_DEVELOPER);
212204
} else if ($msels == 0 && $msels != null) {
@@ -304,31 +296,47 @@ public function get_content() {
304296
}
305297

306298
////////////////////RocketChat/////////////////////////////
307-
if ($showcomms) {
308-
$rocketchaturl = get_config('block_crucible', 'rocketchatappurl');
309-
$rocketchat = null;
310299

311-
if ($rocketchaturl) {
312-
$rocketchat = $crucible->get_rocketchat_user_info();
313-
}
300+
$rocketchaturl = get_config('block_crucible', 'rocketchatappurl');
301+
$rocketchat = null;
302+
$showrocketchat = null;
314303

315-
if ($rocketchat) {
316-
$rocketperms = $rocketchat->user->roles;
317-
318-
if ($showapps) {
319-
$data->rocket = $rocketchaturl;
320-
$data->rocketDescription = get_string('rocketchatdescription', 'block_crucible');
321-
$data->rocketLogo = $OUTPUT->image_url('icon-rocketchat', 'block_crucible');
322-
} else if (in_array("admin", $rocketperms)) {
323-
$data->rocket = $rocketchaturl;
324-
$data->rocketDescription = get_string('rocketchatdescription', 'block_crucible');
325-
$data->rocketLogo = $OUTPUT->image_url('icon-rocketchat', 'block_crucible');
326-
}
327-
} else if ($rocketchat == -1) {
328-
debugging("Rocket.Chat is not configured", DEBUG_DEVELOPER);
304+
if ($rocketchaturl) {
305+
$rocketchat = $crucible->get_rocketchat_user_info();
306+
$showrocketchat = get_config('block_crucible', 'showrocketchat');
307+
}
308+
309+
if ($rocketchat) {
310+
$rocketperms = $rocketchat->user->roles;
311+
312+
if ($showapps || in_array("admin", $rocketperms)) {
313+
$data->rocket = $rocketchaturl;
314+
$data->rocketDescription = get_string('rocketchatdescription', 'block_crucible');
315+
$data->rocketLogo = $OUTPUT->image_url('icon-rocketchat', 'block_crucible');
329316
}
330-
} else if ($showcomms == 0) {
331-
debugging("Rocket.Chat not enabled", DEBUG_DEVELOPER);
317+
} else if ($showrocketchat) {
318+
$data->rocket = $rocketchaturl;
319+
$data->rocketDescription = get_string('rocketchatdescription', 'block_crucible');
320+
$data->rocketLogo = $OUTPUT->image_url('icon-rocketchat', 'block_crucible');
321+
} else if ($rocketchat === -1) {
322+
debugging("Rocket.Chat is not configured", DEBUG_DEVELOPER);
323+
}
324+
325+
326+
////////////////////Roundcube/////////////////////////////
327+
$roundcubeurl = get_config('block_crucible', 'roundcubeappurl');
328+
$showroundcube = null;
329+
330+
if ($roundcubeurl) {
331+
$showroundcube = get_config('block_crucible', 'showroundcube');
332+
}
333+
334+
if ($showroundcube) {
335+
$data->roundcube = get_config('block_crucible', 'roundcubeappurl');
336+
$data->roundcubeDescription = get_string('roundcubedescription', 'block_crucible');
337+
$data->roundcubeLogo = $OUTPUT->image_url('icon-roundcube', 'block_crucible');
338+
} else {
339+
debugging("Roundcube not enabled", DEBUG_DEVELOPER);
332340
}
333341

334342
////////////////////TOPOMOJO////////////////////////////

img/communication-settings.png

-147 KB
Binary file not shown.

img/rocketchat-settings.png

422 KB
Loading
-325 KB
Binary file not shown.

img/roundcube-settings.png

205 KB
Loading

0 commit comments

Comments
 (0)