@@ -5,9 +5,113 @@ app_description: Test configuration for MySQL with account provisioning and rand
55
66# Connection settings for the MySQL database
77connect :
8- # Data Source Name (DSN) for our local MySQL instance running in Docker
8+ # Data Source Name (DSN) for our local MySQL instance
99 dsn : " mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}"
1010
11+ actions :
12+ update_user_attributes :
13+ name : Update User Attributes
14+ description : Update the attributes of a user. Only provide the attributes you want to update.
15+ action_type :
16+ - account
17+ - account_update_profile
18+ arguments :
19+ user_id :
20+ name : User ID
21+ type : string
22+ required : true
23+ description : The ID of the user to update
24+ attrs :
25+ name : Attributes
26+ type : string_map
27+ required : true
28+ description : The updated attribute data (map of attribute names to values)
29+ attrs_update_mask :
30+ name : Attributes Update Mask
31+ type : string_list
32+ required : true
33+ description : The attributes to update (list of attribute names from attrs to actually update)
34+ vars :
35+ # Map each attribute in the attrs argument to a variable and a flag to indicate if the attribute should be updated
36+ manager_id : " 'manager_id' in input.attrs ? input.attrs['manager_id'] : null"
37+ update_manager_id : " 'manager_id' in input.attrs_update_mask"
38+ first_name : " 'first_name' in input.attrs ? input.attrs['first_name'] : null"
39+ update_first_name : " 'first_name' in input.attrs_update_mask"
40+ middle_name : " 'middle_name' in input.attrs ? input.attrs['middle_name'] : null"
41+ update_middle_name : " 'middle_name' in input.attrs_update_mask"
42+ last_name : " 'last_name' in input.attrs ? input.attrs['last_name'] : null"
43+ update_last_name : " 'last_name' in input.attrs_update_mask"
44+ display_name : " 'display_name' in input.attrs ? input.attrs['display_name'] : null"
45+ update_display_name : " 'display_name' in input.attrs_update_mask"
46+ job_title : " 'job_title' in input.attrs ? input.attrs['job_title'] : null"
47+ update_job_title : " 'job_title' in input.attrs_update_mask"
48+ department : " 'department' in input.attrs ? input.attrs['department'] : null"
49+ update_department : " 'department' in input.attrs_update_mask"
50+ division : " 'division' in input.attrs ? input.attrs['division'] : null"
51+ update_division : " 'division' in input.attrs_update_mask"
52+ company : " 'company' in input.attrs ? input.attrs['company'] : null"
53+ update_company : " 'company' in input.attrs_update_mask"
54+ employee_id : " 'employee_id' in input.attrs ? input.attrs['employee_id'] : null"
55+ update_employee_id : " 'employee_id' in input.attrs_update_mask"
56+ employee_number : " 'employee_number' in input.attrs ? input.attrs['employee_number'] : null"
57+ update_employee_number : " 'employee_number' in input.attrs_update_mask"
58+ employment_type : " 'employment_type' in input.attrs ? input.attrs['employment_type'] : null"
59+ update_employment_type : " 'employment_type' in input.attrs_update_mask"
60+ # We define the whole update logic with conditional attributes using CASE statements
61+ query : |
62+ UPDATE users
63+ SET
64+ manager_id = CASE
65+ WHEN ?<update_manager_id> THEN ?<manager_id>
66+ ELSE manager_id
67+ END,
68+ attr_first_name = CASE
69+ WHEN ?<update_first_name> THEN ?<first_name>
70+ ELSE attr_first_name
71+ END,
72+ attr_middle_name = CASE
73+ WHEN ?<update_middle_name> THEN ?<middle_name>
74+ ELSE attr_middle_name
75+ END,
76+ attr_last_name = CASE
77+ WHEN ?<update_last_name> THEN ?<last_name>
78+ ELSE attr_last_name
79+ END,
80+ attr_display_name = CASE
81+ WHEN ?<update_display_name> THEN ?<display_name>
82+ ELSE attr_display_name
83+ END,
84+ attr_job_title = CASE
85+ WHEN ?<update_job_title> THEN ?<job_title>
86+ ELSE attr_job_title
87+ END,
88+ attr_department = CASE
89+ WHEN ?<update_department> THEN ?<department>
90+ ELSE attr_department
91+ END,
92+ attr_division = CASE
93+ WHEN ?<update_division> THEN ?<division>
94+ ELSE attr_division
95+ END,
96+ attr_company = CASE
97+ WHEN ?<update_company> THEN ?<company>
98+ ELSE attr_company
99+ END,
100+ employee_id = CASE
101+ WHEN ?<update_employee_id> THEN ?<employee_id>
102+ ELSE employee_id
103+ END,
104+ attr_employee_number = CASE
105+ WHEN ?<update_employee_number> THEN ?<employee_number>
106+ ELSE attr_employee_number
107+ END,
108+ attr_employment_type = CASE
109+ WHEN ?<update_employment_type> THEN ?<employment_type>
110+ ELSE attr_employment_type
111+ END
112+ WHERE
113+ username = ?<user_id>
114+
11115# Definition of different resource types managed by this connector
12116resource_types :
13117 # Configuration for "user" resources in MySQL
@@ -34,7 +138,17 @@ resource_types:
34138 END as last_login,
35139 u.manager_id,
36140 m.username as manager_username,
37- m.email as manager_email
141+ m.email as manager_email,
142+ u.attr_first_name,
143+ u.attr_middle_name,
144+ u.attr_last_name,
145+ u.attr_display_name,
146+ u.attr_job_title,
147+ u.attr_department,
148+ u.attr_division,
149+ u.attr_company,
150+ u.attr_employee_number,
151+ u.attr_employment_type
38152 FROM
39153 users u
40154 LEFT JOIN
@@ -80,6 +194,16 @@ resource_types:
80194 manager_id : " .manager_id"
81195 manager_username : " .manager_username"
82196 manager_email : " .manager_email"
197+ attr_first_name : " .attr_first_name"
198+ attr_middle_name : " .attr_middle_name"
199+ attr_last_name : " .attr_last_name"
200+ attr_display_name : " .attr_display_name"
201+ attr_job_title : " .attr_job_title"
202+ attr_department : " .attr_department"
203+ attr_division : " .attr_division"
204+ attr_company : " .attr_company"
205+ attr_employee_number : " .attr_employee_number"
206+ attr_employment_type : " .attr_employment_type"
83207
84208 # Account provisioning configuration with password support
85209 account_provisioning :
@@ -125,7 +249,17 @@ resource_types:
125249 END as last_login,
126250 u.manager_id,
127251 m.username as manager_username,
128- m.email as manager_email
252+ m.email as manager_email,
253+ u.attr_first_name,
254+ u.attr_middle_name,
255+ u.attr_last_name,
256+ u.attr_display_name,
257+ u.attr_job_title,
258+ u.attr_department,
259+ u.attr_division,
260+ u.attr_company,
261+ u.attr_employee_number,
262+ u.attr_employment_type
129263 FROM users u
130264 LEFT JOIN users m ON u.manager_id = m.id
131265 WHERE u.username = ?<username>
0 commit comments