Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
c928a211
Commit
c928a211
authored
Aug 13, 2021
by
Eric Rosenbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update permissions
parent
b4c96f31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
6 deletions
+5
-6
src/redux/studio-permissions.js
src/redux/studio-permissions.js
+2
-3
src/redux/studio.js
src/redux/studio.js
+3
-3
No files found.
src/redux/studio-permissions.js
View file @
c928a211
...
...
@@ -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
}
...
...
src/redux/studio.js
View file @
c928a211
...
...
@@ -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
}));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment