OpenCyber Academy
Bachelor's · Chapter 8 · English
Course code: OCA-102Chapter 08: OCA-102-C008

Chapter 8 — Programming II

Open, free learning for anyone who wants to protect people and technology. No account is required to read this text or its worked answers.

Permanent link

Public activity · 30d

—Participating browsers

—Page views

—Reading sessions

—Exercise opens

Counts reflect browsers that allowed analytics. A reading session requires 30 seconds on a visible page. Browsers are not people.

Learning outcomes

You will (1) build a larger script with functions and tests; (2) combine two data sources; (3) produce a monthly identity report.

8.1 Combining sources

Elena's second-year script combines the HR staff list with the office suite export. Each source names people differently: HR uses employee numbers, the office suite uses email addresses. She writes a function to match them using a mapping table maintained by HR, and reports any person who cannot be matched. Combining sources is where many identity checks go wrong, because a mismatch in naming can make a current employee look like a leaver or hide a real leaver behind a slightly different spelling.

8.2 Functions and tests

The script is organised into functions: read HR, read accounts, match, analyse and report. Each has tests using small synthetic files where Elena knows the right answer, including awkward cases such as a person who changed surname and an account with capital letters in the email. Tests run before each monthly use. When Greenhill changes its export format, a failing test warns Elena immediately, instead of the report quietly producing wrong numbers that someone might act on. New awkward cases are added as tests whenever they appear in real data.

8.3 The monthly report

The report lists accounts without a current employee, staff without multi-factor authentication by team, accounts unused for ninety days and administrator accounts. Each list includes counts and percentages with bases, and the report header gives export dates and script version. Elena sends it to the IT lead, who decides actions. She avoids changing accounts herself: her role is to provide accurate evidence. The report becomes the baseline against which later improvements are measured during her capstone. Each month's report is stored with the previous ones for comparison.

Worked example

The combined script matches 138 of 140 staff automatically; two unmatched names are resolved with HR, one a surname change and one a typo.

Synthetic case. Sources, names and counts are synthetic.

Errors and limits

Matching people by display name instead of a stable identifier mistakes surname changes for leavers.

Exercises

  • EX022 — Matching key. How does Elena match HR records to accounts?
    Show marking criteria
    Rubric: 3 = mapping table from employee number to email;; 2 = mapping;; 1 = names;; 0 = none.
  • EX023 — Unmatched causes. What caused the two unmatched names?
    Show marking criteria
    Rubric: 3 = surname change and a typo;; 2 = two causes;; 1 = leavers;; 0 = none.
  • EX024 — Elena's role. Why does Elena not change accounts herself?
    Show marking criteria
    Rubric: 3 = her role is evidence; IT lead decides actions;; 2 = evidence only;; 1 = no time;; 0 = none.

Synthesis

Carefully matched sources, tested functions and a clear monthly report make identity evidence dependable.

Continue studying — chapter 08 of 40

← Chapter 07 (draft) · Course chapter index · Chapter 09 (draft) →

Practice the exercises

Open a prompt, write your response, then compare it with the worked answer. Five-choice practice appears where a reviewed question is available.

EX022

Opens in 30 days: — · browsers: —

Checking for a reviewed five-choice question…

EX023

Opens in 30 days: — · browsers: —

Checking for a reviewed five-choice question…

EX024

Opens in 30 days: — · browsers: —

Checking for a reviewed five-choice question…

Worked answers

EX022. With an HR-maintained mapping table from employee number to email address.

EX023. A surname change and a typo.

EX024. Her role is to provide accurate evidence; the IT lead decides actions.