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
5e282dab
authored
Jan 29, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
issue #845 fixed
parent
e30fb526
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
19 deletions
sails/src/api/controllers/StudentController.js
sails/src/api/models/Student.js
sails/src/api/policies/isSupervisorOfStudentOrIsSupAdmin.js
sails/src/assets/scripts/app.js
sails/src/assets/scripts/modules/student/views/header.html
sails/src/tasks/config/concat.js
sails/src/api/controllers/StudentController.js
View file @
5e282dab
...
...
@@ -144,7 +144,7 @@ module.exports = {
else
if
(
stu_sup
&&
!
req
.
token
.
office
)
student
.
supervision
=
1
;
// requester is tutor of the studend
else
if
(
stu_sup
&&
req
.
token
.
office
&&
student
.
office
==
req
.
token
.
office
.
id
)
student
.
supervision
=
2
;
// requester is supervisor of student
student
.
supervision
=
2
;
// requester is supervisor of student
if
(
student
.
supervision
==
-
1
)
// should not hace access!!!
return
res
.
forbidden
(
"Access to this student should not be granted to you"
);
...
...
sails/src/api/models/Student.js
View file @
5e282dab
...
...
@@ -266,20 +266,14 @@ module.exports = {
// student
supervisors
:
function
(
id_stu
,
callback
)
{
StuSup
.
find
({
id_stu
:
id_stu
}).
populate
(
'supervisor'
).
exec
(
function
(
err
,
stuSups
)
{
var
l
=
[];
if
(
err
||
!
stuSups
||
stuSups
.
length
==
0
)
return
callback
(
err
,
l
);
if
(
err
)
return
callback
(
err
,
[]);
if
(
!
stuSups
||
stuSups
.
length
==
0
)
return
callback
(
new
Error
(
"No supervisors found"
),
[]);
async
.
eachSeries
(
stuSups
,
function
(
stuSup
,
next
)
{
l
.
push
(
stuSup
.
supervisor
);
next
();
},
function
(
err
)
{
return
callback
(
err
,
l
);
}
);
var
sups
=
stuSups
.
map
((
st
)
=>
{
return
st
.
supervisor
});
return
callback
(
null
,
sups
);
});
},
...
...
sails/src/api/policies/isSupervisorOfStudentOrIsSupAdmin.js
View file @
5e282dab
...
...
@@ -28,8 +28,11 @@ module.exports = function isSupervisorOfStudentOrIsSupAdmin(req, res, next) {
sails
.
log
.
debug
(
`Supervisor
${
supervisorId
}
is assigned to Student
${
studentId
}
`
);
next
();
}
})
;
})
}
})
.
catch
((
err
)
=>
{
res
.
json
(
401
,
{
error
:
"No student found"
})
});
}
};
sails/src/assets/scripts/app.js
View file @
5e282dab
...
...
@@ -8,7 +8,6 @@ var dashboardApp = angular.module('dashboardApp', [
'dashboardServices'
,
'dashboardDirectives'
,
'pascalprecht.translate'
,
'vcRecaptcha'
,
'ui.bootstrap'
,
'angularFileUpload'
,
'angular.filter'
,
...
...
sails/src/assets/scripts/modules/student/views/header.html
View file @
5e282dab
...
...
@@ -46,7 +46,7 @@
</div>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<ul
class=
"nav nav-tabs tabs_student"
>
<ul
class=
"nav nav-tabs tabs_student"
>
<!-- 0: admin, 1: tutor, 2: therapist -->
<li
role=
"presentation"
ng-class=
"{'active' : nav.tab == 'collections'}"
ng-if=
"studentData.supervision != 0"
>
<a
href=
"/app/#/student/{{studentData.id}}/collections"
ng-click=
"nav.tab = ''"
><span
class=
"glyphicon glyphicon-th"
aria-hidden=
"true"
></span>
{{ 'collections' | translate }}
</a>
</li>
...
...
@@ -59,7 +59,7 @@
<li
role=
"presentation"
ng-class=
"{'active' : nav.tab == 'reports'}"
ng-if=
"studentData.supervision != 1"
>
<a
href=
"/app/#/student/{{studentData.id}}/reports"
ng-click=
"nav.tab = 'reports'"
><span
class=
"glyphicon glyphicon-file"
aria-hidden=
"true"
></span>
{{ 'reports' | translate }}
</a>
</li>
<li
role=
"presentation"
ng-class=
"{'active' : nav.tab == 'setup'}"
ng-if=
"studentData.supervision !=
1
"
>
<li
role=
"presentation"
ng-class=
"{'active' : nav.tab == 'setup'}"
ng-if=
"studentData.supervision !=
0
"
>
<a
href=
"/app/#/student/{{studentData.id}}/setup"
ng-click=
"nav.tab = 'setup'"
><span
class=
"glyphicon glyphicon-cog"
aria-hidden=
"true"
></span>
{{ 'setup' | translate }}
</a>
</li>
...
...
sails/src/tasks/config/concat.js
View file @
5e282dab
...
...
@@ -7,8 +7,6 @@ module.exports = function (grunt) {
'assets/app/bower_components/angular-ui-router/release/angular-ui-router.js'
,
'assets/app/bower_components/angular-translate/angular-translate.js'
,
'assets/app/bower_components/angular-translate-loader-static-files/angular-translate-loader-static-files.js'
,
'assets/app/bower_components/angular-re-captcha/angular-re-captcha.js'
,
// TODO: delete after testing angular-recaptcha
'assets/app/bower_components/angular-recaptcha/release/angular-recaptcha.min.js'
,
'assets/app/bower_components/ng-file-upload/angular-file-upload.js'
,
'assets/app/bower_components/angular-filter/dist/angular-filter.js'
,
...
...
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