The Business Rules Engine

Step 4: Create a User Account

Now all you need to do is give Tina access to your new database. CodaServer makes use of roles to help bundle together permissions on different system objects.

CREATE ROLE student_editor
     DISPLAYED AS 'Student Editor';

Now the role needs permission to actually do stuff.

GRANT SELECT, INSERT, UPDATE, DELETE
     ON addresses TO student_editor;

GRANT SELECT, INSERT, UPDATE, DELETE
     ON countries TO student_editor;

GRANT VIEW, UPDATE, CALL
     ON students:entered TO student_editor;

GRANT VIEW, UPDATE, CALL
     ON students:removed TO student_editor;

Now we need to create a user account for Tina. You can almost feel it now.

CREATE USER tina
     IDENTIFIED BY 'sh4ked4b00t13'
     ( 
       FIRST_NAME = 'Tina', 
       EMAIL = 'tinaismeana@gmail.com'
     )

All that remains is to give Tina access to the "student_editor" role, give her permission to connect to the application, and give her access to the server itself.

GRANT ROLE student_editor ON students.dev TO tina;

GRANT CONNECT ON students TO tina;

GRANT CONNECT TO tina;

And you're done. As you lean back in your chair with a satisfied grin on your face, your phone begins to ring...