mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 08:31:23 -05:00
update permissions
This commit is contained in:
parent
b4c96f3193
commit
c928a21135
2 changed files with 5 additions and 6 deletions
|
@ -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}));
|
||||
|
|
Loading…
Reference in a new issue