Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b0215055
authored
Feb 02, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
GET /office/get/:id/supervisors working
parent
e9ada63d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
sails/src/api/controllers/OfficeController.js
sails/src/api/policies/isAdminOrIsSupAdmin.js
sails/src/api/controllers/OfficeController.js
View file @
b0215055
...
...
@@ -144,15 +144,16 @@ module.exports = {
.
populate
(
'student'
)
.
then
((
stusups
)
=>
{
var
sup_obj
=
sup
.
toObject
();
sup_obj
.
students
=
stusups
.
map
((
stusup
)
=>
{
return
stusup
.
student
});
sup_obj
.
students
=
stusups
.
map
((
stusup
)
=>
{
return
stusup
.
student
;
});
sups
.
push
(
sup_obj
);
next
();
})
.
catch
((
err
)
=>
next
(
err
));
},
function
(
err
)
{
if
(
err
)
return
res
.
serverError
(
"Unable to get students"
);
return
res
.
ok
(
sups
);
return
res
.
ok
(
sups
);
});
})
.
catch
(
function
()
{
...
...
sails/src/api/policies/isAdminOrIsSupAdmin.js
View file @
b0215055
...
...
@@ -3,7 +3,7 @@ module.exports = function isAdmin (req, res, next) {
//
// Only if the user that has connected is global administrator (Yotta employee)
//
if
(
!
req
.
token
||
!
(
req
.
token
.
isAdmin
||
req
.
token
.
isSupAdmin
)
)
if
(
!
req
.
token
||
!
req
.
token
.
isAdmin
&&
!
req
.
token
.
isSupAdmin
)
res
.
json
(
401
,
{
error
:
'Access denied'
});
// Finally, if the user has a clean record, we'll call the `next()` function
...
...
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