Commit c928a211 authored by Eric Rosenbaum's avatar Eric Rosenbaum

update permissions

parent b4c96f31
......@@ -55,10 +55,9 @@ const selectCanRemoveManager = (state, managerId) =>
const selectCanPromoteCurators = state => !selectIsMuted(state) && isManager(state);
const selectCanTransfer = (state, managerId) => {
// Classroom studios are not transferable by educators, only by admins
if (state.studio.classroomId !== null) return false; // (classroomId state is only set for educators)
if (state.studio.classroomId !== null) return false; // Nobody can transfer class studios
if (state.studio.managers > 1) { // If there is more than one manager,
if (managerId === state.studio.owner) { // and the selected manager is the owner/host,
if (managerId === state.studio.owner) { // and the selected manager is the current owner/host,
if (isCreator(state)) return true; // Owner/host can transfer
if (selectIsAdmin(state)) return true; // Admin can transfer
}
......
......@@ -4,7 +4,7 @@ const {withAdmin} = require('../lib/admin-requests');
const api = require('../lib/api');
const log = require('../lib/log');
const {selectUsername, selectToken, selectIsEducator} = require('./session');
const {selectUsername, selectToken, selectIsEducator, selectIsAdmin} = require('./session');
const Status = keyMirror({
FETCHED: null,
......@@ -28,7 +28,7 @@ const getInitialState = () => ({
owner: null,
public: null,
// BEWARE: classroomId is only loaded if the user is an educator
// BEWARE: classroomId is only loaded if the user is an educator or admin
classroomId: null,
rolesStatus: Status.NOT_FETCHED,
......@@ -164,7 +164,7 @@ const getRoles = () => ((dispatch, getState) => {
});
// Since the user is now loaded, it's a good time to check if the studio is part of a classroom
if (selectIsEducator(state)) {
if (selectIsEducator(state) || selectIsAdmin(state)) {
api({uri: `/studios/${studioId}/classroom`}, (err, body, res) => {
// No error states for inability/problems loading classroom, just swallow them
if (!err && res.statusCode === 200 && body) dispatch(setInfo({classroomId: body.id}));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment