cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Community Member

Is there a quick way to get the user list for each admin role?

We have several sub-accounts in Canvas. Each sub-account has their own sub-accounts too.

We also have several different account admin roles with different permissions.

Some people have the account admin; some people have sub-account admin; some people have course admin for whole institution; some people have course admin only for one of our campus; some people have course admin only for a department, etc.

Is there a quick way to get the user list for each admin role (account admin, course admin, sub-account admin, etc.) instead of looking for admins from each sub-account manually?

Thanks!

15 Replies
Highlighted
Surveyor

I asked this question about a year ago, and the answer was "no" at that time and I haven't seen anything to indicate a change has happened.  I've since done a regular inventory of all 200+ accounts/subaccounts in our instance of Canvas manually.  It would be nice if this function existed.

Highlighted
Community Member

Thanks for your reply. That is a lot of work to do it manually. Smiley Sad

0 Kudos
Highlighted

Hey abunag@pacific.edu‌, after I spent way too much time writing a script to do this and got ready to publish it, I stumbled across your original question from December 7, 2015, and the discussion that followed included a script I wrote on December 9, 2015, that creates a Google Sheet with this information in it.

Since my new script does essentially the same thing -- the information that is available is still the same -- it just does it from within Canvas rather than as a Google Sheet and exports it as a CSV file, do you mind sharing what about the original script made it an unworkable solution? I don't use this feature myself, but I want it to be useful to people, so I would hate to repeat any mistakes I made the first time.

Highlighted
Navigator

I have not looked into this recently, but thought there might be something in Canvas Data that would help.

I found the following SQL (MySQL flavor) will return everyone who has a special role other than student.

SELECT DISTINCT r.name, u.name 
FROM role_dim r
JOIN enrollment_dim e ON (r.id = e.role_id)
JOIN user_dim u ON (e.user_id = u.id)
WHERE r.name != 'StudentEnrollment';

But alas, it failed to return a list of admins in those roles. The reason is that admins aren't course level enrollments, which is where the enrollment_dim information is pulled from. Admins are account level enrollments.

I leave the code there just in case someone else was looking for a list of non-student users and so someone won't waste their time trying to find it there.

There was another possibility with the enrollment_rollup_dim table and account_admin_role_count, but that failed to show anyone either.

It shouldn't have to be manually done, though (I say that, but things are often just not there).

The following API calls should be usable to automate the process (again, untested).

  • A list of the roles can be obtained from the List Roles endpoint of the Roles API.
  • A list of the accounts and subaccounts can be found through Get the sub-accounts of an account endpoint of the Accounts API. Be sure to specify recursive if you have more than one level of accounts.
  • A list of the admins for a subaccount can be found using the List account admins endpoint of the Admins API.

Then it's a matter of cycling through each of the accounts and subaccounts, fetching a list of admins, and matching the role_id from the admin list with the id from the list of roles.

Not as simple as being built-in, but it should be easier than manually maintaining the list.

Highlighted
Community Member

Thanks. But I am not quite sure how to do the API calls.

But I have found I can get some data from Admins: Get :GET /v1/accounts/{account_id}/admins in the live API page.

See the screenshot below. I need to type in the account_id to try it out. I just tried to type in 1, it returned the user data for "Course Admin". But I don't know the account_id for other admin roles.

219212_Screen Shot 2017-03-03 at 5.43.41 PM.png

Highlighted

You're not alone with not knowing how to use the APIs. It's has a learning curve to it and if you've not had any programming experience, then you're pretty much limited to using the live API like you did or putting the GET request in the browser. That works for small requests as you can add a per_page=100 to almost any GET request and get up to 100. Then you can copy/paste that into sites that convert JSON into CSV and get something usable. But a real solution should be programmed.

Most of the time it asks for an account ID, you can use self

Otherwise, you can go to the Admin menu and click on your account. The account number should be at the end of the URL

You need to start with the accounts and only do the admins after you have that list.

Highlighted
Surveyor

I did save the code and run against my Canvas Data.  Thanks for that.  I agree though that better admin reporting would be wonderful.  

Highlighted
Navigator

I threw together a user script over the weekend that would generate a list of admin users. You click a button, it makes all the API calls, and then generates a CSV file. It's added to Canvas through the use of a user script manager like Greasemonkey (Firefox) or Tampermonkey (Chrome or Safari)

It gets a list of account admins. It does not include a list of people who have an elevated level of access at a course level.

When ran from a sub-account, it only lists the admins for that subaccount and its child subaccounts.

Information

Right now, I include the following information in the CSV file:

  • User: Name, Login, Sortable Name, Canvas user ID, SIS user ID, SIS login id
  • Role: Name, Canvas role ID
  • Account: Name, Canvas ID, SIS account ID

What I had available to pick from included:

  • User: id, integration_id, login_id, name, short_name, sis_import_id, sis_login_id, sis_user_id, sortable_name
  • Role: base_role_type, id, label, permissions, role [deprecated alias for label], workflow_state
  • Account: default_group_storage_quote_mb, default_storage_quota_mb, default_time_zone, default_user_storage_quota_mb, id, name, parent_account_id, root_account_id, workflow_state

Notes about the available data

User

  • The email is not available through those requests, it would need a separate API call for each user that was an admin and that could take a while.
  • For us, there's not much difference between short name and name, so I just went with name. The sortable_name is "Last, First" so it becomes sortable by last name.

Role

  • The base_role_type is AccountMembership for each account user. I'm using this as a filter, so it's the same for everyone and I didn't see any need in including it.
  • I filter on workflow_state being 'active', so it's another one of those things that doesn't make sense to be included in the data since it's always going to be 'active'.
  • permissions is basically a repeat of what you get when you go to the Account > Permissions. That information already has a pretty decent (although crowded) interface through the web and while it could be exported, the only way I can think to do it is to add a separate column for each permission, so there would be about 54 more columns added to the spreadsheet with cryptic names like "send_messages" or "send_messages_all". My guess (hope) it that people wanting this report are wanting it for the list of users, not for all of the extra stuff that's maintained somewhere else. By the way, when you read the stuff later about adding information, that doesn't apply to permissions as it's an object that would have to be iterated over (and make sure the order is kept straight since its an object and not an array) and the others are simple string values.

Account

  • There's a lot of stuff regarding storage quotas here. I didn't see how that was germane to this report.
  • The parent_account_id and root_account_id could be used to establish some kind of hierarchy of sub accounts, but I figured that most people knew what their hierarchy is and indenting in the spreadsheet to reflect that isn't really a viable option.
  • The workflow_state is used as a filter on 'active', so displaying it doesn't accomplish anything.

The script is set up so that you can modify what information is displayed and what order it is displayed in. People can add or take away from the initial settings to meet their needs. You can always go in and add, remove, or reorder items to meet your needs.

The current state in column ordering in my development code is: Name, Role, Account, Login, Sortable_Name, Account_ID, User_ID, Role_ID, SIS_User, SIS_Login, SIS_Account

What I'm looking for is a reasonable set of defaults for the information displayed and the order it's displayed in. That is, what people will get if they don't go in and modify anything.

Activation

Currently, it adds a button on the main page for an account or subaccount (Admin > your account).

219211_pastedImage_4.png

Is there a better place for it?

Course Admins

The original request here mentioned "course Admins".

The list of roles obtained includes other things besides account roles, but as far as I can tell (I might be missing something), there is nothing available through the API that says "Give me a list of all the people who have that role somewhere in the system". That means that you need to resort to some kind of iterating through each enrollment (whether by course, section, or user.

That means that this is a lengthy and time consuming process that is not suited for a place where a user clicks a button and wants an answer right away. The best approach right now might be to use Canvas Data to obtain a list of those users. I shared some code above, but it needs improved to make sure the enrollments are active and the provide additional information about the user and the course.

Call for Suggestions

I probably won't use this script myself. We've got very few administrators at our institution and we know who they are. That means that I'm developing for an unknown audience and part of making it useful is making sure that the people who are going to use it are going to be able to get use out of it. It needs to be simple enough to install and use and yet powerful enough to accomplish what is needed.

It may sound like I've got things well thought out, but I'm not the one using it so this is your chance to provide feedback before the release.

In particular, I'm looking for suggestions on the following:

  • What the defaults should be as to what information is displayed and in what order? I want this to be as useful out of the box as it can be without burdening people down with too much information.
  • Do any of the column titles need changed? I vacillated between "User" and "Name" for the person's name.
  • Where should the button to activate this script be placed?
  • Information I'm missing that could be used to provide additional information without slowing it down too much.

This script is essentially finished, I just need to do some more testing and write documentation. That means that I'm looking for tweaks that won't substantially delay its release. That also means that if you're not quick to provide feedback, it may get released before you get that chance.

Highlighted
Community Member

Thanks very much!

  • "Course Admin" is one of the account roles in our institution, as the screenshot below. We would like to get the list of users (name, login id, etc.) for each account role.

219794_Screen Shot 2017-03-07 at 10.51.39 AM.png

  • Where should the button to activate this script be placed?--- The place you suggested in the main page for an account or subaccount looks very good! 

When will the button be available to be used, please?

Top Kudoed Authors
Labels