- Find
/admin/create_course
: - Change the endpoint name to
/instructor/create_course
- Change tag from
Admin
toInstructor
- Change security from
adminAuthorizer
toinstructorAuthorizer
- Change
x-amazon-apigateway-integration
URI from:to:arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${adminFunction.Arn}/invocations
arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${instructorFunction.Arn}/invocations
- Remove the case:
"POST /admin/create_course"
- Add the same case and rename it to
"POST /instructor/create_course"
- In
frontend/src/pages/instructor/InstructorSidebar.jsx
create a sidebar entry for creating a course - Create a component similar to
frontend/src/pages/admin/AdminCreateCourse.jsx
which calls the new endpoint and put it in the sidebar
- Create a lambda function
- Set it as a pre sign-up trigger for the user pool using
replacing
this.userPool.addTrigger( cognito.UserPoolOperation.PRE_SIGN_UP, <lamba> );
<lambda>
with your lambda function
- In the lambda function, specify the domains and ensure the user's email attribute matches the domain. Example code is shown below:
exports.handler = async (event) => { const allowedDomains = ['example.com', 'anotherdomain.com']; // Add allowed domains here const email = event.request.userAttributes.email; const domain = email.split('@')[1]; if (!allowedDomains.includes(domain)) { throw new Error("Sign up is restricted to specific email domains."); } return event; };