0
0
DynamoDBquery~10 mins

Condition keys for row-level security in DynamoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to allow access only if the partition key matches the user's ID.

DynamoDB
"ConditionExpression": "[1] = :userId"
Drag options to blanks, or click blank then click option'
AuserId
BpartitionKey
CsortKey
Dattribute_exists
Attempts:
3 left
💡 Hint
Common Mistakes
Using attribute_exists instead of the partition key.
Using sortKey when only partitionKey is needed.
2fill in blank
medium

Complete the condition to check if the user's role attribute equals 'admin'.

DynamoDB
"ConditionExpression": "[1] = :adminRole"
Drag options to blanks, or click blank then click option'
Arole
Buser_type
CuserRole
DaccessLevel
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'userRole' which might not exist.
Using 'accessLevel' which is not the attribute name.
3fill in blank
hard

Fix the error in the condition expression to check if the attribute 'status' is 'active'.

DynamoDB
"ConditionExpression": "[1] = :activeStatus"
Drag options to blanks, or click blank then click option'
Astatus
BStatus
Cattribute_exists(status)
Dstatus = active
Attempts:
3 left
💡 Hint
Common Mistakes
Using capitalized 'Status' which is incorrect.
Using 'attribute_exists' which checks presence, not value.
4fill in blank
hard

Fill both blanks to allow access only if the partition key matches and the user role is 'editor'.

DynamoDB
"ConditionExpression": "[1] = :userId AND [2] = :editorRole"
Drag options to blanks, or click blank then click option'
ApartitionKey
BuserId
Crole
DuserRole
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'userId' as the key instead of 'partitionKey'.
Using 'userRole' instead of 'role' for the role attribute.
5fill in blank
hard

Fill all three blanks to restrict access where partition key matches, role is 'viewer', and status is 'active'.

DynamoDB
"ConditionExpression": "[1] = :userId AND [2] = :viewerRole AND [3] = :activeStatus"
Drag options to blanks, or click blank then click option'
ApartitionKey
Brole
Cstatus
DuserId
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'userId' with 'partitionKey'.
Using 'userId' in place of 'role' or 'status'.