massbay-cs / cs225-proj4

https://gitter.im/massbay-cs
Other
0 stars 2 forks source link

Enforce restrictions for Participants authorization level #75

Closed Zenexer closed 8 years ago

Zenexer commented 8 years ago

Checklist

See https://github.com/massbay-cs/cs225-proj4/wiki/Authorization for the information that Prof. Moussavi has provided about authorization/privileges.

I sent an email on Friday explaining the first step. For convenience, here's what the email said:

By Sunday night at midnight: Add a comment in your issue listing the restrictions that your privilege level should have for each field in each table (except the rootkey table, which we're removing).

Here's an example of what that last step should look like for a few fields if your assigned privilege level is Organizers -> Admins:

Questions due by: Monday at 3 PM Code due by: Tuesday at noon

Now we need to take the data you've collected and turn it into code. I've created a class for each privilege level in the auth.levels package. Find the class that corresponds with your issue and develop the class.

Here's how permissions work:

  1. When an operation is in progress, the backend calls the Permissions#checkPermission method with information about the requested operation. It expects that if the operation is in violation of the user's permissions, checkPermission will throw an AuthorizationException.
  2. The Permissions class looks up the privilege level of the current user and obtains an instance of the corresponding Level subclass.
  3. The Permissions class calls one of the checkPermission* methods in the Level subclass named according to the table the operation affects. For example, user-related operations call checkPermissionUsers because the user table is named USERS. It passes a Context object as an argument.
  4. Your Level subclass calls methods on the Context object to describe the restrictions your privilege level places on the particular table/field.

It's up to you to figure out:

  1. How to use the Context class
  2. How to implement the abstract methods from Level
  3. How to ensure you cover all possible cases, without leaving any gaps for anyone to get through

There are some very basic examples in auth.levels.LoggedOutLevel. You'll also want to take a close look at the auth.levels.Level and auth.levels.Level.Context classes.

Important:

Your task is not complete until:

IntelliJ tips:

Nhcdw57 commented 8 years ago

Participants Authorization

Zenexer commented 8 years ago

@chocolatedounut

Questions due by: Monday at 3 PM Code due by: Tuesday at noon

See Step 2 above.