-
Notifications
You must be signed in to change notification settings - Fork 2
Adding Users
Users can be added by using one of three ClassDB functions. These functions are located in the classdb schema and can be executed by either an Instructor or DBManager.
Each of the three functions creates a user on the server that runs the instance of ClassDB, creates a $user schema for them and assigns appropriate privileges on that schema, and grants them the corresponding role for that type of user, registering them if appropriate.
User names must be unique among all users on the server, even ones that have not been created by ClassDB. These user names are case-sensitive, however, it may be a better choice to keep them all lowercase, in order to improve ease of use and compatibility with non-ClassDB facilities. See PostgreSQL.org - Identifiers and Key Words for more information on this behavior and PostgreSQL identifiers.
An Instructor can be created by calling the createInstructor function. This function takes three parameters, which are all case-sensitive:
-
instructorUserName- Required - The username that the user will use to connect to the ClassDB instance -
instructorName- Required - The name of the user. This name will be stored for later reference -
initialPwd- Optional - The initial password for the user. If one is not provided, then the initial password defaults to the user name.
To create an instructor named "Jessica Caldwell" with a username of "caldwellj" and with a default initial password (their username), the following query should be executed:
SELECT classdb.createInstructor('caldwellj', 'Jessica Caldwell');
To create the above user, but with an initial password of "LV8jzugmfFBF", then the following would be executed:
SELECT classdb.createInstructor('caldwellj', 'Jessica Caldwell', 'LV8jzugmfFBF');
A Student can be created by calling the createStudent function. This function takes four parameters, which are all case-sensitive:
-
studentUserName- Required - The username that the user will use to connect to the ClassDB instance -
studentName- Required - The name of the user. This name will be stored for later reference -
schoolID- Optional - The school issued ID that has been assigned to the Student. If provided, it will be stored for later reference -
initialPwd- Optional - The initial password for the user. If one is not provided, then the initial password defaults to the user name
To create a Student named "Emmett Bell" with a username of bell001, without a school ID, and with a default initial password, the following query would be executed:
SELECT classdb.createStudent('bell001', 'Emmett Bell');
To create the above student while providing a school issued ID of "B584452" to be stored, but still with a default password, the following would be executed:
SELECT classdb.createStudent('bell001', 'Emmett Bell', 'B584452');
To create the student with an initial password of "w18nwMcK&606", while still providing the same ID, the following should be executed:
SELECT classdb.createStudent('bell001', 'Emmett Bell', 'B584452', 'w18nwMcK&606');
Finally, if we wanted to create the student with the above initial password, but not provide a school issued ID, the following would be executed:
SELECT classdb.createStudent('bell001', 'Emmett Bell', NULL, 'w18nwMcK&606');
A DBManager can be created by calling the createDBManager function. This function takes three parameters, which are all case-sensitive:
-
managerUserName- Required - The username that the user will use to connect to the ClassDB instance -
managerName- Required - The name for the user -
initialPwd- Optional - The initial password for the user. If one is not provided, then the initial password defaults to the user name
To create a DBManager named "Emilio Martin" with a username of martine and with a default initial password (their username), the following query should be executed:
SELECT classdb.createDBManager('martine', 'Emilio Martin');
To create the above user, but with an initial password of 'Cid8&88#M8Y8', then the following would be executed:
SELECT classdb.createDBManager('martine', 'Emilio Martin', 'Cid8&88#M8Y8');
Andrew Figueroa
Data Science & Systems Lab (DASSL), Western Connecticut State University (WCSU)
(C) 2017- DASSL. ALL RIGHTS RESERVED.
Licensed to others under CC 4.0 BY-SA-NC: https://creativecommons.org/licenses/by-nc-sa/4.0/
PROVIDED AS IS. NO WARRANTIES EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.