Merge pull request from scratchfoundation/hotfix/disallow-students-from-inviting-curators

[Master] Hotfix/disallow students from inviting curators
This commit is contained in:
Kaloyan Manolov 2025-05-15 16:39:56 +03:00 committed by GitHub
commit b46c2cb0cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View file

@ -157,6 +157,7 @@ module.exports.selectIsAdmin = state => get(state, ['session', 'session', 'permi
module.exports.selectUser = state => get(state, ['session', 'session', 'user'], false);
module.exports.selectIsSocial = state => get(state, ['session', 'session', 'permissions', 'social'], false);
module.exports.selectIsEducator = state => get(state, ['session', 'session', 'permissions', 'educator'], false);
module.exports.selectIsStudent = state => get(state, ['session', 'session', 'permissions', 'student'], false);
module.exports.selectProjectCommentsGloballyEnabled = state =>
get(state, ['session', 'session', 'flags', 'project_comments_enabled'], false);
module.exports.selectStudioCommentsGloballyEnabled = state =>

View file

@ -1,6 +1,7 @@
const {selectUserId, selectIsAdmin, selectIsSocial,
selectIsLoggedIn, selectUsername, selectIsMuted,
selectHasFetchedSession, selectStudioCommentsGloballyEnabled} = require('./session');
selectHasFetchedSession, selectStudioCommentsGloballyEnabled,
selectIsStudent} = require('./session');
// Fine-grain selector helpers - not exported, use the higher level selectors below
const isHost = state => selectUserId(state) === state.studio.host;
@ -39,7 +40,9 @@ const selectCanEditCommentsAllowed = state => !selectIsMuted(state) && (selectIs
const selectCanEditOpenToAll = state => !selectIsMuted(state) && isManager(state);
const selectShowCuratorInvite = state => !selectIsMuted(state) && !!state.studio.invited;
const selectCanInviteCurators = state => !selectIsMuted(state) && isManager(state);
// Students should not be able to create studios, this is to address already existing ones.
// See https://scratchfoundation.atlassian.net/browse/POD-220
const selectCanInviteCurators = state => !selectIsMuted(state) && !selectIsStudent(state) && isManager(state);
const selectCanRemoveCurator = (state, username) => {
if (selectIsMuted(state)) return false;
// Admins/managers can remove any curators