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
e8155468
authored
Mar 17, 2017
by
Jose Antonio
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Added arasaac license to supervisor model
parent
83d61be6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
2 deletions
sails/roles/database/files/pictodb-schema.sql
sails/src/CHANGES.md
sails/src/api/controllers/SupervisorController.js
sails/src/api/models/Supervisor.js
sails/src/config/policies.js
sails/src/config/routes.js
sails/roles/database/files/pictodb-schema.sql
View file @
e8155468
...
@@ -372,6 +372,8 @@ CREATE TABLE IF NOT EXISTS `supervisor` (
...
@@ -372,6 +372,8 @@ CREATE TABLE IF NOT EXISTS `supervisor` (
`password`
varchar
(
60
)
CHARACTER
SET
utf8
COLLATE
utf8_bin
NOT
NULL
COMMENT
'Encrypted password using the BCrypt algorithm'
,
`password`
varchar
(
60
)
CHARACTER
SET
utf8
COLLATE
utf8_bin
NOT
NULL
COMMENT
'Encrypted password using the BCrypt algorithm'
,
`id_off`
int
(
11
)
DEFAULT
NULL
,
`id_off`
int
(
11
)
DEFAULT
NULL
,
`active`
boolean
DEFAULT
FALSE
,
`active`
boolean
DEFAULT
FALSE
,
`arasaac_license`
boolean
DEFAULT
FALSE
,
PRIMARY
KEY
(
`id`
),
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`email`
(
`email`
),
UNIQUE
KEY
`email`
(
`email`
),
KEY
`id_off`
(
`id_off`
)
KEY
`id_off`
(
`id_off`
)
...
...
sails/src/CHANGES.md
View file @
e8155468
...
@@ -13,6 +13,11 @@ Changes to be performed manually in servers to upgrade
...
@@ -13,6 +13,11 @@ Changes to be performed manually in servers to upgrade
## Database
## Database
(ToDo in dev)
-
alter table supervisor add arasaac license:
`ALTER TABLE supervisor ADD COLUMN arasaac_license BOOLEAN DEFAULT FALSE;`
(already done in dev)
(already done in dev)
-
load pictocat_tree_populate.sql
-
load pictocat_tree_populate.sql
...
...
sails/src/api/controllers/SupervisorController.js
View file @
e8155468
...
@@ -200,6 +200,31 @@ module.exports = {
...
@@ -200,6 +200,31 @@ module.exports = {
},
},
/**
/**
* Acept Arasaac License
* @param {request} req
* {
* "token": "12398123aas78sf798as7d987234" // Encryted code with supervisor ID, siging role and id_off
* }
*/
accept_arasaac
:
function
(
req
,
res
)
{
var
params
=
req
.
params
.
all
();
Supervisor
.
findOne
(
params
.
id
)
.
then
(
function
(
supervisor
)
{
if
(
!
supervisor
)
throw
new
Error
(
"Error when looking for user"
);
supervisor
.
arasaacLicense
=
true
;
supervisor
.
save
();
res
.
ok
();
})
.
catch
(
function
(
err
)
{
return
res
.
serverError
(
err
.
message
?
err
.
message
:
'Supervisor not found'
);
});
},
/**
* Gets a supervisor by his email
* Gets a supervisor by his email
* @param {request} req {} (width email as url parameter)
* @param {request} req {} (width email as url parameter)
* @param {response} res
* @param {response} res
...
@@ -261,7 +286,7 @@ module.exports = {
...
@@ -261,7 +286,7 @@ module.exports = {
create
:
function
(
req
,
res
)
{
create
:
function
(
req
,
res
)
{
var
params
=
req
.
params
.
all
();
var
params
=
req
.
params
.
all
();
var
supervisor
;
var
supervisor
;
// Send email confirmation
// Send email confirmation
function
sendConfirmationMail
(
cb
)
{
function
sendConfirmationMail
(
cb
)
{
...
@@ -318,7 +343,7 @@ module.exports = {
...
@@ -318,7 +343,7 @@ module.exports = {
return
res
.
serverError
(
"Supervisor created but returned null"
);
return
res
.
serverError
(
"Supervisor created but returned null"
);
supervisor
=
sup
;
supervisor
=
sup
;
if
(
params
.
role
===
'therapist_office'
||
params
.
role
===
'tutor_office'
)
{
if
(
params
.
role
===
'therapist_office'
||
params
.
role
===
'tutor_office'
)
{
sendConfirmationMail
((
err
)
=>
{
sendConfirmationMail
((
err
)
=>
{
if
(
err
)
throw
err
;
if
(
err
)
throw
err
;
...
...
sails/src/api/models/Supervisor.js
View file @
e8155468
...
@@ -84,6 +84,10 @@ module.exports = {
...
@@ -84,6 +84,10 @@ module.exports = {
active
:
{
active
:
{
type
:
'boolean'
type
:
'boolean'
},
},
arasaacLicense
:
{
type
:
'boolean'
,
columnName
:
'arasaac_license'
},
office
:
{
office
:
{
columnName
:
'id_off'
,
columnName
:
'id_off'
,
type
:
'integer'
,
type
:
'integer'
,
...
...
sails/src/config/policies.js
View file @
e8155468
...
@@ -134,6 +134,7 @@ module.exports.policies = {
...
@@ -134,6 +134,7 @@ module.exports.policies = {
change_password
:
true
,
change_password
:
true
,
request_change_password
:
true
,
request_change_password
:
true
,
activate
:
true
,
activate
:
true
,
accept_arasaac
:
[
'tokenAuth'
],
upload
:
[
'tokenAuth'
],
upload
:
[
'tokenAuth'
],
subscribe
:
[
'tokenAuth'
],
subscribe
:
[
'tokenAuth'
],
unsubscribe
:
[
'tokenAuth'
],
unsubscribe
:
[
'tokenAuth'
],
...
...
sails/src/config/routes.js
View file @
e8155468
...
@@ -107,10 +107,12 @@ module.exports.routes = {
...
@@ -107,10 +107,12 @@ module.exports.routes = {
'GET /sup/:id/pic_categories/:id_cat'
:
'PictoController.categories'
,
'GET /sup/:id/pic_categories/:id_cat'
:
'PictoController.categories'
,
'GET /sup/:id/pic_fromcategory/:id_cat'
:
'PictoController.fromcategory'
,
'GET /sup/:id/pic_fromcategory/:id_cat'
:
'PictoController.fromcategory'
,
'GET /sup/:id/pic_fromSymbolStx/page/:page/limit/:limit'
:
'PictoController.fromSymbolStx'
,
'GET /sup/:id/pic_fromSymbolStx/page/:page/limit/:limit'
:
'PictoController.fromSymbolStx'
,
'GET /sup/:id/pic_fromArasaac/page/:page/limit/:limit'
:
'PictoController.fromArasaac'
,
'GET /sup/:id/pic_fromCatSubcat/category/:id_cat/page/:page/limit/:limit'
:
'PictoController.fromCatSubcat'
,
'GET /sup/:id/pic_fromCatSubcat/category/:id_cat/page/:page/limit/:limit'
:
'PictoController.fromCatSubcat'
,
'GET /sup/:id/pic_fromSearch/:text/category/:id_cat/source/:source'
:
'PictoController.fromSearch'
,
'GET /sup/:id/pic_fromSearch/:text/category/:id_cat/source/:source'
:
'PictoController.fromSearch'
,
'GET /sup/email/:email'
:
'SupervisorController.getByEmail'
,
'GET /sup/email/:email'
:
'SupervisorController.getByEmail'
,
'GET /sup/changepass/:email'
:
'SupervisorController.request_change_password'
,
'GET /sup/changepass/:email'
:
'SupervisorController.request_change_password'
,
'GET /sup/arasaac_license/:id'
:
'SupervisorController.accept_arasaac'
,
'PUT /sup/changepass'
:
'SupervisorController.change_password'
,
'PUT /sup/changepass'
:
'SupervisorController.change_password'
,
'PUT /sup/:id'
:
'SupervisorController.update'
,
'PUT /sup/:id'
:
'SupervisorController.update'
,
'POST /sup'
:
'SupervisorController.create'
,
'POST /sup'
:
'SupervisorController.create'
,
...
...
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