Commit Graph

8 Commits

Author SHA1 Message Date
Jeremy Stanley be56c13863 disallow sis enrollment roles as custom role names
to avoid ambiguity, don't allow custom roles named 'student',
'teacher', 'ta', 'observer', or 'designer'

also fix the error message from the api not to assume that
the base role type is invalid

test plan:
 - using the api, try to create a custom role with one of the
   above names
   -> it should tell you the name is reserved
 - also, try to create a custom role with a valid name
   but an invalid base role type
   -> it should tell you the base role type is invalid

Change-Id: Ic7f91a56e79d2929a64780115553ed38aec5f592
Reviewed-on: https://gerrit.instructure.com/15978
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2012-12-13 09:39:59 -07:00
Bracken Mosbacker 2b1488fb90 add role method for getting all base types and related custom roles
This is a convenience method for various places in the UI
that want to show base roles and their types

refs #cnvs-1166

Change-Id: If3138bd0b9bed54bec60c69633e1b704bdda5904
Reviewed-on: https://gerrit.instructure.com/15994
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2012-12-11 14:40:06 -07:00
Jeremy Stanley 8c609bf92e enforce unique role names within an account
also fix a bug in the spec where we weren't testing what we
thought we were testing

test plan:
 1. try to create two roles with the same name
    in the same account.  this should fail.
 2a. create a role.
 2b. change a permission in the role.
 2c. delete the role.
 2d. create a role with the same name as the one
     deleted in the last step.  this should
     succeed.
 2e. the permission change made in 2b should not
     be present in the newly created role

Change-Id: I3d7eb3a3f14c75eb42d1a1da22603b41c7e25b94
Reviewed-on: https://gerrit.instructure.com/15743
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-12-04 13:52:25 -07:00
Bracken Mosbacker 481067601e enforce permissions for new course roles
Updates the role permission checking to use base role types
(Account type and enrollment types) when calculating
permissions

Test Plan:
 * Test all the permissions
 * Test again
 * Create custom roles for accounts and each enrollment type
 * Change permissions and verify they work correctly
 * Delete roles and verify they still enforce permissions
 * Create roles in parent accounts and make changes in sub accounts
 * Verify those permissions too

closes #11740

Change-Id: Icce22f961065073b27252bb9e2f238de1e59e33b
Reviewed-on: https://gerrit.instructure.com/15735
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-12-03 12:15:13 -07:00
James Williams f06cfbf0f6 migrate account membership types to new role engine
test plan:
* migrate and confirm that the csv in
 account.membership_types is now split into
 Role objects with base_role_type of
 'AccountMembership'
* also, roleoverrides that aren't referenced
 in membership_types are assumed to have been deleted
 so confirm that a Role is still made
 but it is 'inactive'

Change-Id: Ic96c0ecdfd70e5678f74467686a9c9f385e53725
Reviewed-on: https://gerrit.instructure.com/15712
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-11-30 16:42:24 -07:00
James Williams 14312793f6 update role override api for managing/creating course roles
test plan:
* specs (for now)
* (once able to check with the UI) test the api actions:
 'activate', 'add_role', 'index', 'remove_role' and 'update'
 for course roles (by setting the base_role_type argument)

closes #11743 #11744

Change-Id: I1b8d54c37cf7dc32b6898349a1b6452349dac7c0
Reviewed-on: https://gerrit.instructure.com/15590
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-11-28 10:51:01 -07:00
Jeremy Stanley 22e89bba38 check for name conflicts when validating Roles
refs #11739

Change-Id: I4cdca3926af368aef9ad00fd026af17f4daec525
Reviewed-on: https://gerrit.instructure.com/15634
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
2012-11-28 08:46:14 -07:00
Jeremy Stanley ec71b713f6 data structures for course roles engine
closes #11739

test plan: run specs (this is just infrastructure, no
functionality yet)

Change-Id: Icbe5a8db49665cede4371e023c6e37c32a1ad978
Reviewed-on: https://gerrit.instructure.com/15511
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-26 13:49:56 -07:00