From 6a4d512f9a344d5ef50e241cd5dd5305a97833b9 Mon Sep 17 00:00:00 2001
From: Luis Felipe Risch <lfr20@inf.ufpr.br>
Date: Tue, 1 Dec 2020 11:37:58 -0300
Subject: [PATCH] Add loading spinner + restrictions regarding user permissions

---
 .../Components/DataCards/ActivityCard.js      |   3 +-
 .../Components/DataCards/CollectionCard.js    |   3 +-
 .../DataCards/CommunityQuestionCard.js        |  30 ++-
 .../Components/DataCards/ComplaintsCard.js    |   3 +-
 .../DataCards/EducationalObjectsCard.js       |   3 +-
 .../Components/DataCards/InstitutionsCard.js  |  28 ++-
 .../Components/DataCards/NoteVarCard.js       |   5 +-
 .../Components/DataCards/RatingCard.js        |   5 +-
 .../Components/Inputs/CreateInstitution.js    | 165 ++++++++------
 .../Components/Inputs/CreateLanguage.js       | 167 ++++++++------
 .../Components/Inputs/CreateQuestion.js       | 207 ++++++++++--------
 .../Components/Inputs/CreateRating.js         | 164 ++++++++------
 .../Components/Inputs/EditCollection.js       |  29 ++-
 .../Components/Inputs/EditEducationalObect.js |  32 ++-
 .../Components/Inputs/EditLanguage.js         |  30 ++-
 .../Components/Inputs/EditRating.js           |  30 ++-
 .../Components/Inputs/IntitutionsInputs.js    |  40 +++-
 .../Components/Inputs/NoteVarInputs.js        |  30 ++-
 src/Admin/Pages/Pages/Admin.js                |  51 +++--
 src/Admin/Pages/Pages/SubPages/Activity.js    |   3 +-
 src/Admin/Pages/Pages/SubPages/Collections.js |   3 +-
 .../Pages/SubPages/CommunityQuestions.js      |  34 ++-
 src/Admin/Pages/Pages/SubPages/Complaints.js  |  33 ++-
 .../Pages/SubPages/EducationalObjects.js      |   3 +-
 .../Pages/Pages/SubPages/Institutions.js      |   3 +-
 src/Admin/Pages/Pages/SubPages/Languages.js   |   3 +-
 .../Pages/Pages/SubPages/NoteVariables.js     |   3 +-
 src/Admin/Pages/Pages/SubPages/Questions.js   |  30 ++-
 src/Admin/Pages/Pages/SubPages/Rating.js      |   3 +-
 src/Admin/Pages/Pages/SubPages/SendEmail.js   |  59 +++--
 30 files changed, 782 insertions(+), 420 deletions(-)

diff --git a/src/Admin/Components/Components/DataCards/ActivityCard.js b/src/Admin/Components/Components/DataCards/ActivityCard.js
index 29459574..7b5eba7d 100644
--- a/src/Admin/Components/Components/DataCards/ActivityCard.js
+++ b/src/Admin/Components/Components/DataCards/ActivityCard.js
@@ -31,6 +31,7 @@ import Grid from "@material-ui/core/Grid";
 import { GetAData } from "../../../Filters";
 import { GetSpecificData } from '../../../Services';
 import { Link } from 'react-router-dom'
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 
 const ActivityCard = ({ match }) => {
     console.log(match);
@@ -74,7 +75,7 @@ const ActivityCard = ({ match }) => {
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         console.log(item)
         const DATA = [
diff --git a/src/Admin/Components/Components/DataCards/CollectionCard.js b/src/Admin/Components/Components/DataCards/CollectionCard.js
index f43e9eb0..2657bc5c 100644
--- a/src/Admin/Components/Components/DataCards/CollectionCard.js
+++ b/src/Admin/Components/Components/DataCards/CollectionCard.js
@@ -33,6 +33,7 @@ import EditRoundedIcon from "@material-ui/icons/EditRounded";
 import { GetAData } from "../../../Filters";
 import { GetSpecificData } from '../../../Services';
 import { Link } from 'react-router-dom'
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 
 const CollectionCard = ({ match }) => {
     console.log(match);
@@ -75,7 +76,7 @@ const CollectionCard = ({ match }) => {
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         const DATA = [
             {
diff --git a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js
index be8dadfb..812a2c6a 100644
--- a/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js
+++ b/src/Admin/Components/Components/DataCards/CommunityQuestionCard.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect } from "react";
+import React, { useState, useEffect, useContext } from "react";
 import moment from 'moment';
 // Maerial ui components
 import Card from "@material-ui/core/Card";
@@ -31,11 +31,14 @@ import { useStyles } from "../../Styles/DataCard";
 import EmailRoundedIcon from '@material-ui/icons/EmailRounded';
 //imports from local files
 import { GetAData } from "../../../Filters";
+import { Store } from '../../../../Store';
 import { Link } from 'react-router-dom'
 import { GetSpecificData } from "../../../Services";
+import Unauthorized from "../Unauthorized";
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 
 const CommunityQuestions = ({ match }) => {
-    console.log(match);
+    const { state, dispatch } = useContext(Store);
     const classes = useStyles();
 
     const [error, setError] = useState(null); //Necessary to consult the API, catch errors
@@ -49,6 +52,22 @@ const CommunityQuestions = ({ match }) => {
             .toString();
     };
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
     useEffect(() => {
         const headers = {
             Accept: "application/json",
@@ -75,9 +94,8 @@ const CommunityQuestions = ({ match }) => {
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
-    } else {
-        console.log(item)
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         const DATA = [
             {
                 subTitle: "ID",
@@ -150,7 +168,7 @@ const CommunityQuestions = ({ match }) => {
                 </CardContent>
             </Card>
         );
-    }
+    } else return <Unauthorized/>
 };
 
 export default CommunityQuestions;
diff --git a/src/Admin/Components/Components/DataCards/ComplaintsCard.js b/src/Admin/Components/Components/DataCards/ComplaintsCard.js
index f5e6099e..cbf6c800 100644
--- a/src/Admin/Components/Components/DataCards/ComplaintsCard.js
+++ b/src/Admin/Components/Components/DataCards/ComplaintsCard.js
@@ -44,6 +44,7 @@ import { GetSpecificData, HandleComplain } from "../../../Services";
 import { Link } from "react-router-dom";
 import { CardActions } from "@material-ui/core";
 import { apiDomain } from '../../../../env';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 import SnackBar from '../../../../Components/SnackbarComponent';
 //styles
 
@@ -449,7 +450,7 @@ const CollectionCard = ({ match }) => {
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         const DATA = [
             {
diff --git a/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js b/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js
index e3072a96..3cd89ced 100644
--- a/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js
+++ b/src/Admin/Components/Components/DataCards/EducationalObjectsCard.js
@@ -35,6 +35,7 @@ import { Link } from "react-router-dom";
 import { GetSpecificData } from "../../../Services";
 import { apiUrl, apiDomain } from "../../../../env";
 import { Grid } from "@material-ui/core";
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 
 const CommunityQuestions = ({ match }) => {
     console.log(match);
@@ -69,7 +70,7 @@ const CommunityQuestions = ({ match }) => {
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         console.log(item);
         const DATA = [
diff --git a/src/Admin/Components/Components/DataCards/InstitutionsCard.js b/src/Admin/Components/Components/DataCards/InstitutionsCard.js
index fc3c3625..a3513dc4 100644
--- a/src/Admin/Components/Components/DataCards/InstitutionsCard.js
+++ b/src/Admin/Components/Components/DataCards/InstitutionsCard.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect } from "react";
+import React, { useState, useEffect, useContext } from "react";
 import moment from 'moment'
 // Maerial ui components
 import Card from "@material-ui/core/Card";
@@ -31,14 +31,20 @@ import Grid from '@material-ui/core/Grid';
 import EditRoundedIcon from "@material-ui/icons/EditRounded";
 //imports from local files
 import { GetAData } from "../../../Filters";
-import { Link } from 'react-router-dom'
+import { Store } from '../../../../Store';
+import { Link } from 'react-router-dom';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 
 const InstitutionCard = ({ match }) => {
     console.log(match);
+
+    const { state, dispatch } = useContext(Store);
     const classes = useStyles();
 
     const [error, setError] = useState(null); //Necessary to consult the API, catch errors
     const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete
+    const [isAuthorized, setIsAuthorized] = useState(false);
+
     const [item, setItem] = useState({}); //Necessary to consult the API, data
 
     const DisplayDate = (date) => {
@@ -48,6 +54,19 @@ const InstitutionCard = ({ match }) => {
             .toString();
     };
 
+    const CheckUserPermission = async () => {  
+        console.log(state)   
+        if(state.userIsLoggedIn){
+            console.log("logged")
+            for (let i = 0; i < state.currentUser.roles.length; i++)
+                if (state.currentUser.roles[i].name === 'admin' || state.currentUser.roles[i].name === 'editor')
+                    return true; 
+                else return false; 
+        }
+        else{
+            return false;
+        } 
+    }
 
     useEffect(() => {
         fetch(GetAData('institutions', match.params.id))
@@ -62,12 +81,14 @@ const InstitutionCard = ({ match }) => {
                     setError(error);
                 }
             );
+        if(CheckUserPermission) setIsAuthorized(true); 
+        else setIsAuthorized(false);
     }, []);
 
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         const DATA = [
             {
@@ -133,6 +154,7 @@ const InstitutionCard = ({ match }) => {
                                         startIcon={<EditRoundedIcon/>}
                                         color="primary"
                                         variant="outlined"
+                                        onClick={() => console.log(state.userIsLoggedIn, isAuthorized)}
                                     >
                                         Editar
                                     </Button>
diff --git a/src/Admin/Components/Components/DataCards/NoteVarCard.js b/src/Admin/Components/Components/DataCards/NoteVarCard.js
index 9e1de8c6..546a270d 100644
--- a/src/Admin/Components/Components/DataCards/NoteVarCard.js
+++ b/src/Admin/Components/Components/DataCards/NoteVarCard.js
@@ -31,7 +31,8 @@ import { useStyles } from "../../Styles/DataCard";
 import EditRoundedIcon from "@material-ui/icons/EditRounded";
 //imports from local files
 import { GetAData } from "../../../Filters";
-import { Link } from 'react-router-dom'
+import { Link } from 'react-router-dom';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 
 const NoteCard = ({ match }) => {
     console.log(match);
@@ -67,7 +68,7 @@ const NoteCard = ({ match }) => {
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         const DATA = [
             {
diff --git a/src/Admin/Components/Components/DataCards/RatingCard.js b/src/Admin/Components/Components/DataCards/RatingCard.js
index f56420a8..b610182b 100644
--- a/src/Admin/Components/Components/DataCards/RatingCard.js
+++ b/src/Admin/Components/Components/DataCards/RatingCard.js
@@ -31,7 +31,8 @@ import { useStyles } from "../../Styles/DataCard";
 import EditRoundedIcon from "@material-ui/icons/EditRounded";
 //imports from local files
 import { GetAData } from "../../../Filters";
-import { Link } from 'react-router-dom'
+import { Link } from 'react-router-dom';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';;
 
 const RatingCard = ({ match }) => {
     console.log(match);
@@ -66,7 +67,7 @@ const RatingCard = ({ match }) => {
     if (error) {
         return <div>Houve um erro</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         const DATA = [
             {
diff --git a/src/Admin/Components/Components/Inputs/CreateInstitution.js b/src/Admin/Components/Components/Inputs/CreateInstitution.js
index 62d0565d..cd36b0ab 100644
--- a/src/Admin/Components/Components/Inputs/CreateInstitution.js
+++ b/src/Admin/Components/Components/Inputs/CreateInstitution.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState } from 'react';
+import React, { useState, useContext } from 'react';
 //imports material ui componets
 import Card from "@material-ui/core/Card";
 import CardContent from "@material-ui/core/CardContent";
@@ -28,12 +28,16 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded';
 //imports local files
 import { apiUrl } from '../../../../env';
 import SnackBar from '../../../../Components/SnackbarComponent';
+import { Store } from '../../../../Store';
+import Unauthorized from '../Unauthorized';
 //imports services 
 import { Create } from '../../../Services';
 //router
 import {Link} from 'react-router-dom';
 
 const CreateInstitution = (props) => {
+    const { state, dispatch } = useContext(Store);
+
     const [name, setName] = useState('Nova Instituição');
     const [description, setDescription] = useState('');
     const [adress, setAdress] = useState('');
@@ -104,6 +108,23 @@ const CreateInstitution = (props) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
+
     //Handle submit 
     async function onSubmit() {
         setIsLoading(true)
@@ -185,77 +206,79 @@ const CreateInstitution = (props) => {
         }
     ]
 
-    return (
-        <Card>
-            <SnackBar
-                severity={snackInfo.icon}
-                text={snackInfo.message}
-                snackbarOpen={snackInfo.open}
-                color={snackInfo.color}
-                handleClose={() => setSnackInfo({
-                    message: '',
-                    icon: '',
-                    open: false,
-                    color: ''
-                })}
-            />
-            <CardContent>
-                <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}>
-                    <Grid item>
-                        <Typography variant='h4'>
-                            {name}
-                        </Typography>
-                    </Grid>
-                    <Grid item>
-                        <Link style={{textDecoration: 'none'}} to={'/admin/intitutions'}>
-                            <Button
-                                onClick={props.BackToList}
-                                startIcon={<ListRoundedIcon />}
-                                variant='outlined'
-                                color='primary'
-                            >
-                                Listar
-                            </Button>
-                        </Link>
+    if(CheckUserPermission()){
+        return (
+            <Card>
+                <SnackBar
+                    severity={snackInfo.icon}
+                    text={snackInfo.message}
+                    snackbarOpen={snackInfo.open}
+                    color={snackInfo.color}
+                    handleClose={() => setSnackInfo({
+                        message: '',
+                        icon: '',
+                        open: false,
+                        color: ''
+                    })}
+                />
+                <CardContent>
+                    <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}>
+                        <Grid item>
+                            <Typography variant='h4'>
+                                {name}
+                            </Typography>
+                        </Grid>
+                        <Grid item>
+                            <Link style={{textDecoration: 'none'}} to={'/admin/intitutions'}>
+                                <Button
+                                    onClick={props.BackToList}
+                                    startIcon={<ListRoundedIcon />}
+                                    variant='outlined'
+                                    color='primary'
+                                >
+                                    Listar
+                                </Button>
+                            </Link>
+                        </Grid>
                     </Grid>
-                </Grid>
-
-                <div style={{ height: '1em' }}></div>
-
-                <form style={{ display: 'flex', flexDirection: 'column' }}>
-                    {fields.map((field, index) => (
-                        <TextField
-                            key={index}
-                            required={field.required}
-                            error={field.error}
-                            helperText={field.error ? field.errorMessage : ''}
-                            style={{ width: '250px', marginBottom: '1em' }}
-                            label={field.label}
-                            value={field.value}
-                            onChange={field.onChange}
-                            type="search"
-                            multiline={true}
-                        />
-                    ))}
-                </form>
-            </CardContent>
-            <CardAction>
-                <Button
-                    onClick={() => {
-                        onSubmit();
-                    }}
-                    variant="contained"
-                    color="primary"
-                    disabled={isLoading}
-                    startIcon={isLoading ? null : <AddRoundedIcon />}
-                >
-                    {
-                        isLoading ? <CircularProgress size={24} /> : 'Adicionar'
-                    }
-                </Button>
-            </CardAction>
-        </Card>
-    );
+    
+                    <div style={{ height: '1em' }}></div>
+    
+                    <form style={{ display: 'flex', flexDirection: 'column' }}>
+                        {fields.map((field, index) => (
+                            <TextField
+                                key={index}
+                                required={field.required}
+                                error={field.error}
+                                helperText={field.error ? field.errorMessage : ''}
+                                style={{ width: '250px', marginBottom: '1em' }}
+                                label={field.label}
+                                value={field.value}
+                                onChange={field.onChange}
+                                type="search"
+                                multiline={true}
+                            />
+                        ))}
+                    </form>
+                </CardContent>
+                <CardAction>
+                    <Button
+                        onClick={() => {
+                            onSubmit();
+                        }}
+                        variant="contained"
+                        color="primary"
+                        disabled={isLoading}
+                        startIcon={isLoading ? null : <AddRoundedIcon />}
+                    >
+                        {
+                            isLoading ? <CircularProgress size={24} /> : 'Adicionar'
+                        }
+                    </Button>
+                </CardAction>
+            </Card>
+        );
+    } else return <Unauthorized/>
 }
 
 export default CreateInstitution;
\ No newline at end of file
diff --git a/src/Admin/Components/Components/Inputs/CreateLanguage.js b/src/Admin/Components/Components/Inputs/CreateLanguage.js
index 40e7add7..67dcd596 100644
--- a/src/Admin/Components/Components/Inputs/CreateLanguage.js
+++ b/src/Admin/Components/Components/Inputs/CreateLanguage.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState } from 'react';
+import React, { useState, useContext } from 'react';
 //imports material ui componets
 import Card from "@material-ui/core/Card";
 import CardContent from "@material-ui/core/CardContent";
@@ -28,12 +28,16 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded';
 //imports local files
 import { apiUrl } from '../../../../env';
 import SnackBar from '../../../../Components/SnackbarComponent';
+import { Store } from '../../../../Store';
 //imports services 
 import { Create } from '../../../Services';
 //router
-import {Link} from 'react-router-dom';
+import { Link } from 'react-router-dom';
+import Unauthorized from '../Unauthorized';
 
 const CreateLanguage = (props) => {
+    const { state, dispatch } = useContext(Store);
+
     const [name, setName] = useState('Nova linguagem');
     const [code, setCode] = useState('');
 
@@ -93,6 +97,23 @@ const CreateLanguage = (props) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false;
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true;
+        }
+        else {
+            canUserEdit = false;
+        }
+
+        return canUserEdit;
+    }
+
+
     //Handle submit 
     async function onSubmit() {
         setIsLoading(true)
@@ -150,77 +171,79 @@ const CreateLanguage = (props) => {
         }
     ]
 
-    return (
-        <Card variant='outlined'>
-            <SnackBar
-                severity={snackInfo.icon}
-                text={snackInfo.message}
-                snackbarOpen={snackInfo.open}
-                color={snackInfo.color}
-                handleClose={() => setSnackInfo({
-                    message: '',
-                    icon: '',
-                    open: false,
-                    color: ''
-                })}
-            />
-            <CardContent>
-                <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}>
-                    <Grid item>
-                        <Typography variant='h4'>
-                            {name}
-                        </Typography>
+    if (CheckUserPermission()) {
+        return (
+            <Card>
+                <SnackBar
+                    severity={snackInfo.icon}
+                    text={snackInfo.message}
+                    snackbarOpen={snackInfo.open}
+                    color={snackInfo.color}
+                    handleClose={() => setSnackInfo({
+                        message: '',
+                        icon: '',
+                        open: false,
+                        color: ''
+                    })}
+                />
+                <CardContent>
+                    <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}>
+                        <Grid item>
+                            <Typography variant='h4'>
+                                {name}
+                            </Typography>
+                        </Grid>
+                        <Grid item>
+                            <Link to={'/admin/languages'} style={{ textDecoration: 'none' }}>
+                                <Button
+                                    onClick={props.BackToList}
+                                    startIcon={<ListRoundedIcon />}
+                                    variant='outlined'
+                                    color='primary'
+                                >
+                                    Listar
+                            </Button>
+                            </Link>
+                        </Grid>
                     </Grid>
-                    <Grid item>
-                        <Link to={'/admin/languages'} style={{textDecoration: 'none'}}>
-                            <Button
-                                onClick={props.BackToList}
-                                startIcon={<ListRoundedIcon />}
-                                variant='outlined'
-                                color='primary'
-                            >
-                                Listar
-                        </Button>
-                        </Link>
-                    </Grid>
-                </Grid>
-
-                <div style={{ height: '1em' }}></div>
-
-                <form style={{ display: 'flex', flexDirection: 'column' }}>
-                    {fields.map((field, index) => (
-                        <TextField
-                            key={index}
-                            required={field.required}
-                            error={field.error}
-                            helperText={field.error ? field.errorMessage : ''}
-                            style={{ width: '250px', marginBottom: '1em' }}
-                            label={field.label}
-                            value={field.value}
-                            onChange={field.onChange}
-                            type="search"
-                            multiline={true}
-                        />
-                    ))}
-                </form>
-            </CardContent>
-            <CardAction>
-                <Button
-                    onClick={() => {
-                        onSubmit();
-                    }}
-                    variant="contained"
-                    color="primary"
-                    disabled={isLoading}
-                    startIcon={isLoading ? null : <AddRoundedIcon />}
-                >
-                    {
-                        isLoading ? <CircularProgress size={24} /> : 'Adicionar'
-                    }
-                </Button>
-            </CardAction>
-        </Card>
-    );
+
+                    <div style={{ height: '1em' }}></div>
+
+                    <form style={{ display: 'flex', flexDirection: 'column' }}>
+                        {fields.map((field, index) => (
+                            <TextField
+                                key={index}
+                                required={field.required}
+                                error={field.error}
+                                helperText={field.error ? field.errorMessage : ''}
+                                style={{ width: '250px', marginBottom: '1em' }}
+                                label={field.label}
+                                value={field.value}
+                                onChange={field.onChange}
+                                type="search"
+                                multiline={true}
+                            />
+                        ))}
+                    </form>
+                </CardContent>
+                <CardAction>
+                    <Button
+                        onClick={() => {
+                            onSubmit();
+                        }}
+                        variant="contained"
+                        color="primary"
+                        disabled={isLoading}
+                        startIcon={isLoading ? null : <AddRoundedIcon />}
+                    >
+                        {
+                            isLoading ? <CircularProgress size={24} /> : 'Adicionar'
+                        }
+                    </Button>
+                </CardAction>
+            </Card>
+        )
+    } else return <Unauthorized/>
 }
 
 export default CreateLanguage;
\ No newline at end of file
diff --git a/src/Admin/Components/Components/Inputs/CreateQuestion.js b/src/Admin/Components/Components/Inputs/CreateQuestion.js
index c4279f14..05deca7d 100644
--- a/src/Admin/Components/Components/Inputs/CreateQuestion.js
+++ b/src/Admin/Components/Components/Inputs/CreateQuestion.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState } from 'react';
+import React, { useState, useContext } from 'react';
 //imports material ui componets
 import Card from "@material-ui/core/Card";
 import CardContent from "@material-ui/core/CardContent";
@@ -28,6 +28,8 @@ import MenuItem from "@material-ui/core/MenuItem";
 import ListRoundedIcon from '@material-ui/icons/ListRounded';
 //imports local files
 import { apiUrl } from '../../../../env';
+import { Store } from '../../../../Store';
+import Unauthorized from '../Unauthorized';
 import SnackBar from '../../../../Components/SnackbarComponent';
 //imports services 
 import { Create } from '../../../Services';
@@ -35,6 +37,8 @@ import { Create } from '../../../Services';
 import { Link } from 'react-router-dom';
 
 const CreateQuestion = (props) => {
+    const { state, dispatch } = useContext(Store);
+
     const [status, setStatus] = useState('');
     const [description, setDescription] = useState('');
 
@@ -84,6 +88,23 @@ const CreateQuestion = (props) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
+
     //Handle submit 
     async function onSubmit() {
         setIsLoading(true)
@@ -152,100 +173,102 @@ const CreateQuestion = (props) => {
         },
     ];
 
-    return (
-        <Card>
-            <SnackBar
-                severity={snackInfo.icon}
-                text={snackInfo.message}
-                snackbarOpen={snackInfo.open}
-                color={snackInfo.color}
-                handleClose={() => setSnackInfo({
-                    message: '',
-                    icon: '',
-                    open: false,
-                    color: ''
-                })}
-            />
-            <CardContent>
-                <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}>
-                    <Grid item>
-                        <Typography variant='h4'>
-                            Nova question
-                        </Typography>
-                    </Grid>
-                    <Grid item>
-                        <Link to={'/admin/Questions'} style={{ textDecoration: 'none' }}>
-                            <Button
-                                onClick={props.BackToList}
-                                startIcon={<ListRoundedIcon />}
-                                variant='outlined'
-                                color='primary'
-                            >
-                                Listar
-                            </Button>
-                        </Link>
-                    </Grid>
-                </Grid>
-
-                <div style={{ height: '1em' }}></div>
-
-                <form style={{ display: 'flex', flexDirection: 'column' }}>
-                    <>
-                        <TextField
-                            select
-                            label="Status"
-                            value={status ? status : ""}
-                            error={errorInStatus.error}
-                            style={{ width: '250px', marginBottom: '1em' }}
-                            helperText={errorInStatus.error ? errorInStatus.errorMessage : ''}
-                            onChange={handleChange}
-                        >
-                            {STATUS_OPTIONS.map((option, index) => (
-                                <MenuItem
-                                    key={option.value}
-                                    value={option.value}
-                                    style={option.value === status ? { color: 'blue' } : { color: 'black' }}
+    if(CheckUserPermission()) {
+        return (
+            <Card>
+                <SnackBar
+                    severity={snackInfo.icon}
+                    text={snackInfo.message}
+                    snackbarOpen={snackInfo.open}
+                    color={snackInfo.color}
+                    handleClose={() => setSnackInfo({
+                        message: '',
+                        icon: '',
+                        open: false,
+                        color: ''
+                    })}
+                />
+                <CardContent>
+                    <Grid container direction='row' justify='space-between' alignContent="center" alignItems="center" xs={12}>
+                        <Grid item>
+                            <Typography variant='h4'>
+                                Nova question
+                            </Typography>
+                        </Grid>
+                        <Grid item>
+                            <Link to={'/admin/Questions'} style={{ textDecoration: 'none' }}>
+                                <Button
+                                    onClick={props.BackToList}
+                                    startIcon={<ListRoundedIcon />}
+                                    variant='outlined'
+                                    color='primary'
                                 >
-                                    {
-                                        option.label
-                                    }
-                                </MenuItem>
-                            ))}
-                        </TextField>
-                        {fields.map((field, index) => (
+                                    Listar
+                                </Button>
+                            </Link>
+                        </Grid>
+                    </Grid>
+    
+                    <div style={{ height: '1em' }}></div>
+    
+                    <form style={{ display: 'flex', flexDirection: 'column' }}>
+                        <>
                             <TextField
-                                key={index}
-                                required={field.required}
-                                error={field.error}
-                                helperText={field.error ? field.errorMessage : ''}
+                                select
+                                label="Status"
+                                value={status ? status : ""}
+                                error={errorInStatus.error}
                                 style={{ width: '250px', marginBottom: '1em' }}
-                                label={field.label}
-                                value={field.value}
-                                onChange={field.onChange}
-                                type="search"
-                                multiline={true}
-                            />
-                        ))}
-                    </>
-                </form>
-            </CardContent>
-            <CardAction>
-                <Button
-                    onClick={() => {
-                        onSubmit();
-                    }}
-                    variant="contained"
-                    color="primary"
-                    disabled={isLoading}
-                    startIcon={isLoading ? null : <AddRoundedIcon />}
-                >
-                    {
-                        isLoading ? <CircularProgress size={24} /> : 'Adicionar'
-                    }
-                </Button>
-            </CardAction>
-        </Card>
-    );
+                                helperText={errorInStatus.error ? errorInStatus.errorMessage : ''}
+                                onChange={handleChange}
+                            >
+                                {STATUS_OPTIONS.map((option, index) => (
+                                    <MenuItem
+                                        key={option.value}
+                                        value={option.value}
+                                        style={option.value === status ? { color: 'blue' } : { color: 'black' }}
+                                    >
+                                        {
+                                            option.label
+                                        }
+                                    </MenuItem>
+                                ))}
+                            </TextField>
+                            {fields.map((field, index) => (
+                                <TextField
+                                    key={index}
+                                    required={field.required}
+                                    error={field.error}
+                                    helperText={field.error ? field.errorMessage : ''}
+                                    style={{ width: '250px', marginBottom: '1em' }}
+                                    label={field.label}
+                                    value={field.value}
+                                    onChange={field.onChange}
+                                    type="search"
+                                    multiline={true}
+                                />
+                            ))}
+                        </>
+                    </form>
+                </CardContent>
+                <CardAction>
+                    <Button
+                        onClick={() => {
+                            onSubmit();
+                        }}
+                        variant="contained"
+                        color="primary"
+                        disabled={isLoading}
+                        startIcon={isLoading ? null : <AddRoundedIcon />}
+                    >
+                        {
+                            isLoading ? <CircularProgress size={24} /> : 'Adicionar'
+                        }
+                    </Button>
+                </CardAction>
+            </Card>
+        );
+    } else return <Unauthorized/>
 }
 
 export default CreateQuestion;
\ No newline at end of file
diff --git a/src/Admin/Components/Components/Inputs/CreateRating.js b/src/Admin/Components/Components/Inputs/CreateRating.js
index 111c656f..15ae0756 100644
--- a/src/Admin/Components/Components/Inputs/CreateRating.js
+++ b/src/Admin/Components/Components/Inputs/CreateRating.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState } from 'react';
+import React, { useState, useContext } from 'react';
 //imports material ui componets
 import Card from "@material-ui/core/Card";
 import CardContent from "@material-ui/core/CardContent";
@@ -27,13 +27,17 @@ import AddRoundedIcon from '@material-ui/icons/AddRounded';
 import ListRoundedIcon from '@material-ui/icons/ListRounded';
 //imports local files
 import { apiUrl } from '../../../../env';
+import { Store } from '../../../../Store';
 import SnackBar from '../../../../Components/SnackbarComponent';
 //imports services 
 import { Create } from '../../../Services';
 //router
 import {Link} from 'react-router-dom';
+import Unauthorized from '../Unauthorized';
 
 const CreateRating = (props) => {
+    const { state, dispatch } = useContext(Store);
+
     const [name, setName] = useState('Novo rating');
     const [description, setDescription] = useState('');
 
@@ -93,6 +97,22 @@ const CreateRating = (props) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false;
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true;
+        }
+        else {
+            canUserEdit = false;
+        }
+
+        return canUserEdit;
+    }
+
     //Handle submit 
     async function onSubmit() {
         setIsLoading(true)
@@ -150,77 +170,79 @@ const CreateRating = (props) => {
         }
     ]
 
-    return (
-        <Card>
-            <SnackBar
-                severity={snackInfo.icon}
-                text={snackInfo.message}
-                snackbarOpen={snackInfo.open}
-                color={snackInfo.color}
-                handleClose={() => setSnackInfo({
-                    message: '',
-                    icon: '',
-                    open: false,
-                    color: ''
-                })}
-            />
-            <CardContent>
-                <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}>
-                    <Grid item> 
-                        <Typography variant='h4'>
-                            {name}
-                        </Typography>
-                    </Grid>
-                    <Grid item>
-                        <Link to={'/admin/Ratings'} style={{textDecoration: 'none'}}>
-                            <Button
-                                onClick={props.BackToList}
-                                startIcon={<ListRoundedIcon />}
-                                variant='outlined'
-                                color='primary'
-                            >
-                                Listar
-                            </Button>
-                        </Link>
+    if(CheckUserPermission()) {
+        return (
+            <Card>
+                <SnackBar
+                    severity={snackInfo.icon}
+                    text={snackInfo.message}
+                    snackbarOpen={snackInfo.open}
+                    color={snackInfo.color}
+                    handleClose={() => setSnackInfo({
+                        message: '',
+                        icon: '',
+                        open: false,
+                        color: ''
+                    })}
+                />
+                <CardContent>
+                    <Grid container direction='row' justify='space-between' alignItems="center" alignContent="center" xs={12}>
+                        <Grid item> 
+                            <Typography variant='h4'>
+                                {name}
+                            </Typography>
+                        </Grid>
+                        <Grid item>
+                            <Link to={'/admin/Ratings'} style={{textDecoration: 'none'}}>
+                                <Button
+                                    onClick={props.BackToList}
+                                    startIcon={<ListRoundedIcon />}
+                                    variant='outlined'
+                                    color='primary'
+                                >
+                                    Listar
+                                </Button>
+                            </Link>
+                        </Grid>
                     </Grid>
-                </Grid>
-
-                <div style={{ height: '1em' }}></div>
-
-                <form style={{ display: 'flex', flexDirection: 'column' }}>
-                    {fields.map((field, index) => (
-                        <TextField
-                            key={index}
-                            required={field.required}
-                            error={field.error}
-                            helperText={field.error ? field.errorMessage : ''}
-                            style={{ width: '250px', marginBottom: '1em' }}
-                            label={field.label}
-                            value={field.value}
-                            onChange={field.onChange}
-                            type="search"
-                            multiline={true}
-                        />
-                    ))}
-                </form>
-            </CardContent>
-            <CardAction>
-                <Button
-                    onClick={() => {
-                        onSubmit();
-                    }}
-                    variant="contained"
-                    color="primary"
-                    disabled={isLoading}
-                    startIcon={isLoading ? null : <AddRoundedIcon />}
-                >
-                    {
-                        isLoading ? <CircularProgress size={24} /> : 'Adicionar'
-                    }
-                </Button>
-            </CardAction>
-        </Card>
-    );
+    
+                    <div style={{ height: '1em' }}></div>
+    
+                    <form style={{ display: 'flex', flexDirection: 'column' }}>
+                        {fields.map((field, index) => (
+                            <TextField
+                                key={index}
+                                required={field.required}
+                                error={field.error}
+                                helperText={field.error ? field.errorMessage : ''}
+                                style={{ width: '250px', marginBottom: '1em' }}
+                                label={field.label}
+                                value={field.value}
+                                onChange={field.onChange}
+                                type="search"
+                                multiline={true}
+                            />
+                        ))}
+                    </form>
+                </CardContent>
+                <CardAction>
+                    <Button
+                        onClick={() => {
+                            onSubmit();
+                        }}
+                        variant="contained"
+                        color="primary"
+                        disabled={isLoading}
+                        startIcon={isLoading ? null : <AddRoundedIcon />}
+                    >
+                        {
+                            isLoading ? <CircularProgress size={24} /> : 'Adicionar'
+                        }
+                    </Button>
+                </CardAction>
+            </Card>
+        );
+    } else return <Unauthorized/>
 }
 
 export default CreateRating;
\ No newline at end of file
diff --git a/src/Admin/Components/Components/Inputs/EditCollection.js b/src/Admin/Components/Components/Inputs/EditCollection.js
index 98699262..c3e67100 100644
--- a/src/Admin/Components/Components/Inputs/EditCollection.js
+++ b/src/Admin/Components/Components/Inputs/EditCollection.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect, useRef } from 'react';
+import React, { useState, useEffect, useRef, useContext } from 'react';
 //imports material ui components
 import { Typography, TextField, Button, Grid } from '@material-ui/core';
 import CircularProgress from '@material-ui/core/CircularProgress';
@@ -28,6 +28,9 @@ import SaveIcon from '@material-ui/icons/Save';
 import MenuItem from "@material-ui/core/MenuItem";
 //imports local files
 import SnackBar from '../../../../Components/SnackbarComponent';
+import Unauthorized from '../Unauthorized';
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports services 
 import { Edit, GetSpecificData } from '../../../Services';
 import { EditFilter, GetAData } from '../../../Filters';
@@ -37,6 +40,8 @@ import { Link } from 'react-router-dom';
 import JoditEditor from 'jodit-react';
 
 const EditCollection = ({ match }) => {
+    const { state, dispatch } = useContext(Store);
+
     const [error, setError] = useState(null); //Necessary to consult the API, catch errors
     const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete
 
@@ -152,6 +157,22 @@ const EditCollection = ({ match }) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
     const onSubmit = async () => {
         setIsLoading(true)
         if (!isEmpty(name) && !isEmpty(privacy)) {
@@ -218,8 +239,8 @@ const EditCollection = ({ match }) => {
     if (error) {
         return <div> Houve um erro... </div>
     } else if (!isLoaded) {
-        return <div> Carregando... </div>
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return (
             <Card>
                 <SnackBar
@@ -321,7 +342,7 @@ const EditCollection = ({ match }) => {
                 </CardAction>
             </Card>
         )
-    }
+    } else return <Unauthorized/>
 }
 
 export default EditCollection;
\ No newline at end of file
diff --git a/src/Admin/Components/Components/Inputs/EditEducationalObect.js b/src/Admin/Components/Components/Inputs/EditEducationalObect.js
index c4ea5c91..66a3a867 100644
--- a/src/Admin/Components/Components/Inputs/EditEducationalObect.js
+++ b/src/Admin/Components/Components/Inputs/EditEducationalObect.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect, useRef } from "react";
+import React, { useState, useEffect, useRef, useContext } from "react";
 import PropTypes from "prop-types";
 import SwipeableViews from "react-swipeable-views"; 
 import moment from 'moment';
@@ -38,6 +38,9 @@ import LanguageRoundedIcon from "@material-ui/icons/LanguageRounded";
 import MenuBookRoundedIcon from '@material-ui/icons/MenuBookRounded';
 //imports local files
 import SnackBar from "../../../../Components/SnackbarComponent";
+import { Store } from '../../../../Store';
+import Unauthorized from '../Unauthorized';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports services
 import { Edit, GetFullList, GetSpecificData} from "../../../Services";
 import { EditFilter, GetAData, Url } from "../../../Filters";
@@ -64,6 +67,8 @@ const useStyles = makeStyles((theme) => ({
 }));
 
 const EditEducationalObject = ({ match }) => {
+    const { state, dispatch } = useContext(Store);
+
     const theme = useTheme();
     const classes = useStyles();
 
@@ -495,7 +500,24 @@ const EditEducationalObject = ({ match }) => {
             default: true,
             type: "text",
         },
-    ];
+    ]; 
+
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false;
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true;
+        }
+        else {
+            canUserEdit = false;
+        }
+
+        return canUserEdit;
+    }
+
 
     useEffect(() => {
         GetSpecificData(GetAData("learning_objects", match.params.id))
@@ -513,8 +535,8 @@ const EditEducationalObject = ({ match }) => {
     if (error) {
         return <div> Houve um erro... </div>;
     } else if (!isLoaded) {
-        return <div> Carregando... </div>;
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return (
             <Card variant="outlined">
                 <SnackBar
@@ -707,7 +729,7 @@ const EditEducationalObject = ({ match }) => {
                 </CardAction>
             </Card>
         );
-    }
+    } else return <Unauthorized/>
 };
 
 export default EditEducationalObject;
diff --git a/src/Admin/Components/Components/Inputs/EditLanguage.js b/src/Admin/Components/Components/Inputs/EditLanguage.js
index f890c6d1..d45bf1a4 100644
--- a/src/Admin/Components/Components/Inputs/EditLanguage.js
+++ b/src/Admin/Components/Components/Inputs/EditLanguage.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useContext } from 'react';
 //imports material ui components
 import { Typography, TextField, Button, Grid } from '@material-ui/core';
 import CircularProgress from '@material-ui/core/CircularProgress';
@@ -27,13 +27,18 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded';
 import SaveIcon from '@material-ui/icons/Save';
 //imports local files
 import SnackBar from '../../../../Components/SnackbarComponent';
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports services 
 import { Edit } from '../../../Services';
 import { EditFilter, GetAData } from '../../../Filters';
 //routers
 import {Link} from 'react-router-dom';
+import Unauthorized from '../Unauthorized';
 
 const EditLanguage = ({ match }) => {
+    const { state, dispatch } = useContext(Store);
+
     const [error, setError] = useState(null); //Necessary to consult the API, catch errors
     const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete
 
@@ -123,6 +128,23 @@ const EditLanguage = ({ match }) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false;
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true;
+        }
+        else {
+            canUserEdit = false;
+        }
+
+        return canUserEdit;
+    }
+
+
     const onSubmit = async () => {
         setIsLoading(true)
         if (!isEmpty(name) && !isEmpty(code)) {
@@ -179,8 +201,8 @@ const EditLanguage = ({ match }) => {
     if (error) {
         return <div> Houve um erro... </div>
     } else if (!isLoaded) {
-        return <div> Carregando... </div>
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return (
             <Card>
                 <SnackBar
@@ -248,7 +270,7 @@ const EditLanguage = ({ match }) => {
                 </CardAction>
             </Card>
         )
-    }
+    } else return <Unauthorized/>
 }
 
 export default EditLanguage;
\ No newline at end of file
diff --git a/src/Admin/Components/Components/Inputs/EditRating.js b/src/Admin/Components/Components/Inputs/EditRating.js
index 6b38e471..42b41bb3 100644
--- a/src/Admin/Components/Components/Inputs/EditRating.js
+++ b/src/Admin/Components/Components/Inputs/EditRating.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useContext } from 'react';
 //imports material ui components
 import { Typography, TextField, Button, Grid } from '@material-ui/core';
 import CircularProgress from '@material-ui/core/CircularProgress';
@@ -27,13 +27,18 @@ import ListRoundedIcon from '@material-ui/icons/ListRounded';
 import SaveIcon from '@material-ui/icons/Save';
 //imports local files
 import SnackBar from '../../../../Components/SnackbarComponent';
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports services 
 import { Edit } from '../../../Services';
 import { EditFilter, GetAData } from '../../../Filters';
 //routers
 import {Link} from 'react-router-dom';
+import Unauthorized from '../Unauthorized';
 
 const EditRating = ({ match }) => {
+    const { state, dispatch } = useContext(Store);
+
     const [error, setError] = useState(null); //Necessary to consult the API, catch errors
     const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete
 
@@ -125,6 +130,23 @@ const EditRating = ({ match }) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false;
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true;
+        }
+        else {
+            canUserEdit = false;
+        }
+
+        return canUserEdit;
+    }
+
+
     const onSubmit = async () => {
         setIsLoading(true)
         if (!isEmpty(name) && !isEmpty(description)) {
@@ -181,8 +203,8 @@ const EditRating = ({ match }) => {
     if (error) {
         return <div> Houve um erro... </div>
     } else if (!isLoaded) {
-        return <div> Carregando... </div>
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return (
             <Card>
                 <SnackBar
@@ -254,7 +276,7 @@ const EditRating = ({ match }) => {
                 </CardAction>
             </Card>
         )
-    }
+    } else return <Unauthorized/>
 }
 
 export default EditRating;
\ No newline at end of file
diff --git a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js
index 6e5f1d04..4bc11001 100644
--- a/src/Admin/Components/Components/Inputs/IntitutionsInputs.js
+++ b/src/Admin/Components/Components/Inputs/IntitutionsInputs.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useContext } from 'react';
 //imports material ui components
 import { TextField, Button } from '@material-ui/core';
 import CircularProgress from '@material-ui/core/CircularProgress';
@@ -27,18 +27,25 @@ import Typography from "@material-ui/core/Typography";
 import ListRoundedIcon from "@material-ui/icons/ListRounded";
 import Grid from "@material-ui/core/Grid";
 //imports local files
+import Unauthorized from '../Unauthorized';
 import SnackBar from '../../../../Components/SnackbarComponent';
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports services 
 import { Edit } from '../../../Services';
-import { EditFilter, GetAData } from '../../../Filters'; 
+import { EditFilter, GetAData } from '../../../Filters';
 //Routers
-import {Link} from 'react-router-dom';
+import { Link } from 'react-router-dom';
+import { stat } from 'fs';
 
 let id;
 
 const EditInstitution = ({ match }) => {
+    const { state, dispatch } = useContext(Store);
+
     const [error, setError] = useState(null); //Necessary to consult the API, catch errors
     const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete
+    const [isAuthorized, setIsAuthorized] = useState();
 
     const [name, setName] = useState();
     const [description, setDescription] = useState();
@@ -109,6 +116,22 @@ const EditInstitution = ({ match }) => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
     //Handle submit 
     async function onSubmit() {
         setIsLoading(true)
@@ -214,8 +237,8 @@ const EditInstitution = ({ match }) => {
     if (error) {
         return <div> Erro... </div>
     } else if (!isLoaded) {
-        return <div> Loading... </div>
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if (CheckUserPermission()) {
         return (
             <Card>
                 <SnackBar
@@ -232,7 +255,7 @@ const EditInstitution = ({ match }) => {
                 />
                 <CardContent>
                     <Grid container xs={12} justify="space-between" alignItems="center" alignContent="center">
-                        <Grid item>  
+                        <Grid item>
                             <Typography
                                 variant='h4'
                                 color="inherit"
@@ -243,7 +266,7 @@ const EditInstitution = ({ match }) => {
                         </Grid>
 
                         <Grid item>
-                            <Link style={{textDecoration: 'none'}} to={`/admin/intitutions`}>
+                            <Link style={{ textDecoration: 'none' }} to={`/admin/intitutions`}>
                                 <Button
                                     startIcon={<ListRoundedIcon />}
                                     color="primary"
@@ -293,8 +316,9 @@ const EditInstitution = ({ match }) => {
 
                 </CardContent>
             </Card>
-
         );
+    } else {
+        return <Unauthorized />
     }
 }
 
diff --git a/src/Admin/Components/Components/Inputs/NoteVarInputs.js b/src/Admin/Components/Components/Inputs/NoteVarInputs.js
index bba28a04..7f8b20b3 100644
--- a/src/Admin/Components/Components/Inputs/NoteVarInputs.js
+++ b/src/Admin/Components/Components/Inputs/NoteVarInputs.js
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useState, useEffect } from 'react';
+import React, { useState, useEffect, useContext } from 'react';
 //imports material ui components
 import { TextField, Button } from '@material-ui/core';
 import CircularProgress from '@material-ui/core/CircularProgress';
@@ -28,13 +28,18 @@ import ListRoundedIcon from "@material-ui/icons/ListRounded";
 import Grid from '@material-ui/core/Grid';
 //imports local files
 import SnackBar from '../../../../Components/SnackbarComponent';
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports services 
 import { Edit } from '../../../Services';
 import { EditFilter, GetAData } from '../../../Filters';
 //Routers
 import { Link } from 'react-router-dom';
+import Unauthorized from '../Unauthorized';
 
 const NoteVarInputs = ({ match }) => {
+    const { state, dispatch } = useContext(Store);
+
     const [error, setError] = useState(null); //Necessary to consult the API, catch errors
     const [isLoaded, setIsLoaded] = useState(false); //Necessary to consult the API, wait until complete
 
@@ -192,6 +197,23 @@ const NoteVarInputs = ({ match }) => {
         }
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false;
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true;
+        }
+        else {
+            canUserEdit = false;
+        }
+
+        return canUserEdit;
+    }
+
+
     useEffect(() => {
         fetch(GetAData("scores", match.params.id))
             .then((res) => res.json())
@@ -212,8 +234,8 @@ const NoteVarInputs = ({ match }) => {
     if (error) {
         return <div>Houve um erro...</div>
     } else if (!isLoaded) {
-        return <div> Carregando...</div>
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return (
             <Card>
                 <SnackBar
@@ -290,7 +312,7 @@ const NoteVarInputs = ({ match }) => {
                 </CardContent>
             </Card>
         )
-    }
+    } else return <Unauthorized/>
 }
 
 export default NoteVarInputs;
\ No newline at end of file
diff --git a/src/Admin/Pages/Pages/Admin.js b/src/Admin/Pages/Pages/Admin.js
index a3471465..ab5d4379 100644
--- a/src/Admin/Pages/Pages/Admin.js
+++ b/src/Admin/Pages/Pages/Admin.js
@@ -42,14 +42,14 @@ import Inframe from './SubPages/Inframe';
 import Languages from './SubPages/Languages';
 import Activity from './SubPages/Activity';
 import InstitutionCard from '../../Components/Components/DataCards/InstitutionsCard';
-import InstitutionsInput from '../../Components/Components/Inputs/IntitutionsInputs'; 
-import CreateInstitution from '../../Components/Components/Inputs/CreateInstitution'; 
+import InstitutionsInput from '../../Components/Components/Inputs/IntitutionsInputs';
+import CreateInstitution from '../../Components/Components/Inputs/CreateInstitution';
 import NoteVarCard from '../../Components/Components/DataCards/NoteVarCard';
 import NoteVarInputs from '../../Components/Components/Inputs/NoteVarInputs';
 import EditLanguage from '../../Components/Components/Inputs/EditLanguage';
 import CreateLanguage from '../../Components/Components/Inputs/CreateLanguage';
 
-import ActivityCard from '../../Components/Components/DataCards/ActivityCard'; 
+import ActivityCard from '../../Components/Components/DataCards/ActivityCard';
 
 import CommunityQuestions from './SubPages/CommunityQuestions';
 import CommunityCard from '../../Components/Components/DataCards/CommunityQuestionCard';
@@ -60,11 +60,11 @@ import EditCollection from '../../Components/Components/Inputs/EditCollection';
 
 import Ratings from './SubPages/Rating';
 import RatingCard from '../../Components/Components/DataCards/RatingCard';
-import EditRating from '../../Components/Components/Inputs/EditRating'; 
+import EditRating from '../../Components/Components/Inputs/EditRating';
 import CreateRating from '../../Components/Components/Inputs/CreateRating';
 
 import Questions from './SubPages/Questions';
-import CreateQuestions from '../../Components/Components/Inputs/CreateQuestion'; 
+import CreateQuestions from '../../Components/Components/Inputs/CreateQuestion';
 
 import EducationalObject from './SubPages/EducationalObjects';
 import EducationalObjectCard from '../../Components/Components/DataCards/EducationalObjectsCard';
@@ -72,6 +72,7 @@ import EducationalObjectEdit from '../../Components/Components/Inputs/EditEducat
 
 import Complaints from './SubPages/Complaints';
 import ComplaintCard from '../../Components/Components/DataCards/ComplaintsCard';
+import { match } from 'assert';
 
 const useStyles = makeStyles({
     list: {
@@ -91,10 +92,8 @@ const fab = {
     position: 'fixed',
 }
 
-
 export default function Admin() {
     const { state, dispatch } = useContext(Store);
-
     const classes = useStyles();
 
     //State of the Drawer
@@ -125,7 +124,7 @@ export default function Admin() {
         >
             <List>
                 {TabsItens.map((text, index) => (
-                    <Link to={text.href} key={text.label} style={{color : "black"}}>
+                    <Link to={text.href} key={text.label} style={{ color: "black" }}>
                         <ListItem button key={text.label} onClick={() => setIndexIcon(index)}>
                             <IconButton>
                                 <DisplayIcon i={index} />
@@ -143,11 +142,11 @@ export default function Admin() {
             <Switch>
                 <div style={{ paddingTop: '2em', paddingLeft: '2em', paddingRight: '2em', paddingBottom: '2em', backgroundColor: '	#D3D3D3' }}>
                     <Route path='/admin/home' component={Welcome} />
-                    
+
                     <Route path='/admin/intitutions' component={Institution} />
-                    <Route path='/admin/institution/:id' component={InstitutionCard}/>
+                    <Route path='/admin/institution/:id' component={InstitutionCard} />
                     <Route path='/admin/institutionEdit/:id' component={InstitutionsInput}/>
-                    <Route path='/admin/InstitutionCreate' component={CreateInstitution}/> 
+                    <Route path='/admin/InstitutionCreate' component={CreateInstitution} />
 
                     <Route path='/admin/noteVars' component={NoteVariables} />
                     <Route path='/admin/noteVar/:id' component={NoteVarCard} />
@@ -157,34 +156,34 @@ export default function Admin() {
                     <Route path='/admin/languageEdit/:id' component={EditLanguage} />
                     <Route path='/admin/languageCreate' component={CreateLanguage} />
 
-                    <Route path='/admin/CommunityQuestions' component={CommunityQuestions}/>
-                    <Route path='/admin/CommunityQuestion/:id' component={CommunityCard}/>
+                    <Route path='/admin/CommunityQuestions' component={CommunityQuestions} />
+                    <Route path='/admin/CommunityQuestion/:id' component={CommunityCard} />
 
-                    <Route path='/admin/Collections' component={Collections}/>
-                    <Route path='/admin/Collection/:id' component={CollectionCard}/>
-                    <Route path='/admin/EditCollection/:id' component={EditCollection}/>
+                    <Route path='/admin/Collections' component={Collections} />
+                    <Route path='/admin/Collection/:id' component={CollectionCard} />
+                    <Route path='/admin/EditCollection/:id' component={EditCollection} />
 
-                    <Route path='/admin/Ratings' component={Ratings}/>
-                    <Route path='/admin/Rating/:id' component={RatingCard}/>
-                    <Route path='/admin/EditRating/:id' component={EditRating}/>
-                    <Route path='/admin/CreateRating' component={CreateRating}/>
+                    <Route path='/admin/Ratings' component={Ratings} />
+                    <Route path='/admin/Rating/:id' component={RatingCard} />
+                    <Route path='/admin/EditRating/:id' component={EditRating} />
+                    <Route path='/admin/CreateRating' component={CreateRating} />
 
-                    <Route path='/admin/Questions' component={Questions}/>
-                    <Route path='/admin/CreateQuestion' component={CreateQuestions}/>
+                    <Route path='/admin/Questions' component={Questions} />
+                    <Route path='/admin/CreateQuestion' component={CreateQuestions} />
 
                     <Route path='/admin/activities' component={Activity} />
                     <Route path='/admin/activity/:id' component={ActivityCard} />
 
                     <Route path='/admin/learningObjects' component={EducationalObject} />
                     <Route path='/admin/learningObject/:id' component={EducationalObjectCard} />
-                    <Route path='/admin/learningObjectEdit/:id' component={EducationalObjectEdit} /> 
+                    <Route path='/admin/learningObjectEdit/:id' component={EducationalObjectEdit} />
 
-                    <Route path='/admin/complaints' component={Complaints} /> 
-                    <Route path='/admin/complaint/:id' component={ComplaintCard} /> 
+                    <Route path='/admin/complaints' component={Complaints} />
+                    <Route path='/admin/complaint/:id' component={ComplaintCard} />
 
                     <Route path='/admin/sendEmail/:email' component={SendEmail} />
                     <Route path='/admin/inframe' component={Inframe} />
-                    
+
                 </div>
             </Switch>
 
diff --git a/src/Admin/Pages/Pages/SubPages/Activity.js b/src/Admin/Pages/Pages/SubPages/Activity.js
index e26bd37e..dbdc94fd 100644
--- a/src/Admin/Pages/Pages/SubPages/Activity.js
+++ b/src/Admin/Pages/Pages/SubPages/Activity.js
@@ -23,6 +23,7 @@ import TableData from "../../../Components/Components/Table";
 import SnackBar from "../../../../Components/SnackbarComponent";
 import { Url } from "../../../Filters";
 import { GetFullList } from "../../../Services";
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports from material ui
 import { withStyles } from "@material-ui/core/styles";
 import TableBody from "@material-ui/core/TableBody";
@@ -232,7 +233,7 @@ const Activity = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
 
         return <>
diff --git a/src/Admin/Pages/Pages/SubPages/Collections.js b/src/Admin/Pages/Pages/SubPages/Collections.js
index dbb96d39..fb89bfbf 100644
--- a/src/Admin/Pages/Pages/SubPages/Collections.js
+++ b/src/Admin/Pages/Pages/SubPages/Collections.js
@@ -24,6 +24,7 @@ import SnackBar from "../../../../Components/SnackbarComponent";
 import { Url, EditFilter } from "../../../Filters";
 import { GetFullList, Delete } from "../../../Services";
 import AlertDialog from "../../../Components/Components/AlertDialog";
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports from material ui
 import { withStyles } from "@material-ui/core/styles";
 import TableBody from "@material-ui/core/TableBody";
@@ -304,7 +305,7 @@ const Collections = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
 
         return <>
diff --git a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js
index 8fa874d4..3f855606 100644
--- a/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js
+++ b/src/Admin/Pages/Pages/SubPages/CommunityQuestions.js
@@ -16,13 +16,16 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useEffect, useState } from "react";
+import React, { useEffect, useState, useContext } from "react";
 import moment from 'moment';
 //imports from local files
 import TableData from "../../../Components/Components/Table";
 import SnackBar from "../../../../Components/SnackbarComponent";
+import Unauthorized from '../../../Components/Components/Unauthorized';
 import { Url } from "../../../Filters";
 import { GetFullList } from "../../../Services";
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports from material ui
 import { withStyles } from "@material-ui/core/styles";
 import TableBody from "@material-ui/core/TableBody";
@@ -62,7 +65,9 @@ const StyledTableRow = withStyles((theme) => ({
     },
 }))(TableRow);
 
-const Activity = () => {
+const CommunityQuestion = () => {
+    const { state, dispatch } = useContext(Store);
+
     const ADD_ONE_LENGHT = [""];
     const TOP_LABELS = [
         "ID",
@@ -259,6 +264,22 @@ const Activity = () => {
             .toString();
     };
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
     //getting data from server
     useEffect(() => {
         GetFullList(Url("contacts", "", `${currPage}`, "DESC")).then(
@@ -280,9 +301,8 @@ const Activity = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
-    } else {
-
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return <>
             <SnackBar
                 severity={snackInfo.icon}
@@ -545,6 +565,6 @@ const Activity = () => {
                 </TableBody>
             </TableData>
         </>
-    };
+    } else return <Unauthorized/>
 }
-export default Activity;
+export default CommunityQuestion;
diff --git a/src/Admin/Pages/Pages/SubPages/Complaints.js b/src/Admin/Pages/Pages/SubPages/Complaints.js
index f94c9362..f88fe4fd 100644
--- a/src/Admin/Pages/Pages/SubPages/Complaints.js
+++ b/src/Admin/Pages/Pages/SubPages/Complaints.js
@@ -16,13 +16,15 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useEffect, useState } from "react";
+import React, { useEffect, useState, useContext } from "react";
 import moment from "moment";
 //imports from local files
 import TableData from "../../../Components/Components/Table";
 import SnackBar from "../../../../Components/SnackbarComponent";
 import { Url } from "../../../Filters";
 import { GetFullList } from "../../../Services";
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //imports from material ui
 import { withStyles } from "@material-ui/core/styles";
 import TableBody from "@material-ui/core/TableBody";
@@ -40,6 +42,7 @@ import VisibilityIcon from "@material-ui/icons/Visibility";
 import LaunchRoundedIcon from "@material-ui/icons/LaunchRounded";
 //routers
 import { Link } from "react-router-dom";
+import Unauthorized from "../../../Components/Components/Unauthorized";
 
 let currPage = 0;
 let currIdFilter;
@@ -64,6 +67,8 @@ const StyledTableRow = withStyles((theme) => ({
 }))(TableRow);
 
 const Complaints = () => {
+    const { state, dispatch } = useContext(Store);
+
     const PORTAL_MEC = "https://plataformaintegrada.mec.gov.br/";
 
     const ADD_ONE_LENGHT = [""];
@@ -119,6 +124,22 @@ const Complaints = () => {
         });
     };
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
     //handle load more items
     const LoadMoreItens = async (api) => {
         setIsLoadingMoreItems(true);
@@ -317,8 +338,8 @@ const Complaints = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return (
             <>
                 <SnackBar
@@ -505,7 +526,9 @@ const Complaints = () => {
                                             </StyledTableCell>
                                             <StyledTableCell align="right">
                                                 <Link to={`/admin/complaint/${row.id}`}>
-                                                    <IconButton>
+                                                    <IconButton
+                                                        onClick={() => {currPage = 0}}
+                                                    >
                                                         <VisibilityIcon style={{ fill: "#00bcd4" }} />
                                                     </IconButton>
                                                 </Link>
@@ -544,6 +567,6 @@ const Complaints = () => {
                 </Grid>
             </>
         );
-    }
+    } else return <Unauthorized/>
 };
 export default Complaints;
diff --git a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js
index 127351ef..519db7af 100644
--- a/src/Admin/Pages/Pages/SubPages/EducationalObjects.js
+++ b/src/Admin/Pages/Pages/SubPages/EducationalObjects.js
@@ -22,6 +22,7 @@ import moment from 'moment';
 import TableData from "../../../Components/Components/Table";
 import SnackBar from "../../../../Components/SnackbarComponent";
 import AlertDialog from "../../../Components/Components/AlertDialog";
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 // Imports about icon
 import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded";
 import AddRoundedIcon from "@material-ui/icons/AddRounded";
@@ -281,7 +282,7 @@ const EducationalObjects = () => {
         return <div>Error: {error.message}</div>;
     }
     if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         //Words that defines that column
         const topTable = [
diff --git a/src/Admin/Pages/Pages/SubPages/Institutions.js b/src/Admin/Pages/Pages/SubPages/Institutions.js
index e1d74e29..9e6243c0 100644
--- a/src/Admin/Pages/Pages/SubPages/Institutions.js
+++ b/src/Admin/Pages/Pages/SubPages/Institutions.js
@@ -21,6 +21,7 @@ import React, { useState, useEffect } from "react";
 import TableData from "../../../Components/Components/Table";
 import SnackBar from "../../../../Components/SnackbarComponent";
 import AlertDialog from "../../../Components/Components/AlertDialog";
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 // Imports about icon
 import FilterListRoundedIcon from "@material-ui/icons/FilterListRounded";
 import AddRoundedIcon from "@material-ui/icons/AddRounded";
@@ -329,7 +330,7 @@ const Institutions = () => {
         return <div>Error: {error.message}</div>;
     }
     if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         //Words that defines that column
         const topTable = [
diff --git a/src/Admin/Pages/Pages/SubPages/Languages.js b/src/Admin/Pages/Pages/SubPages/Languages.js
index 64005fd7..317ffcbd 100644
--- a/src/Admin/Pages/Pages/SubPages/Languages.js
+++ b/src/Admin/Pages/Pages/SubPages/Languages.js
@@ -23,6 +23,7 @@ import SnackBar from '../../../../Components/SnackbarComponent';
 import AlertDialog from "../../../Components/Components/AlertDialog";
 import { Url } from '../../../Filters';
 import { GetFullList, Delete } from '../../../Services';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 import { DeleteFilter } from '../../../Filters';
 //imports from material ui 
 import { withStyles } from '@material-ui/core/styles';
@@ -204,7 +205,7 @@ const Languages = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
         return (
             <>
diff --git a/src/Admin/Pages/Pages/SubPages/NoteVariables.js b/src/Admin/Pages/Pages/SubPages/NoteVariables.js
index 0d3b33ff..aa5213c5 100644
--- a/src/Admin/Pages/Pages/SubPages/NoteVariables.js
+++ b/src/Admin/Pages/Pages/SubPages/NoteVariables.js
@@ -34,6 +34,7 @@ import UpdateRoundedIcon from '@material-ui/icons/UpdateRounded'
 //Local files
 import TableData from '../../../Components/Components/Table';
 import SnackBar from '../../../../Components/SnackbarComponent';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //Services
 import { Url } from '../../../Filters';
 import { GetFullList } from '../../../Services';
@@ -162,7 +163,7 @@ const NoteVariables = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
 
         //Words in the top part of the table
diff --git a/src/Admin/Pages/Pages/SubPages/Questions.js b/src/Admin/Pages/Pages/SubPages/Questions.js
index 70b07a98..7d83877e 100644
--- a/src/Admin/Pages/Pages/SubPages/Questions.js
+++ b/src/Admin/Pages/Pages/SubPages/Questions.js
@@ -16,12 +16,15 @@ GNU Affero General Public License for more details.
 You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
-import React, { useEffect, useState } from 'react'
+import React, { useEffect, useState, useContext } from 'react'
 import moment from 'moment';
 //imports from local files 
 import TableData from '../../../Components/Components/Table';
 import SnackBar from '../../../../Components/SnackbarComponent';
+import Unauthorized from '../../../Components/Components/Unauthorized';
 import { Url, EditFilter } from '../../../Filters';
+import { Store } from '../../../../Store';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 import { GetFullList, Edit } from '../../../Services';
 //imports from material ui 
 import { withStyles } from '@material-ui/core/styles';
@@ -60,6 +63,8 @@ const StyledTableRow = withStyles((theme) => ({
 }))(TableRow);
 
 const Questions = () => {
+    const { state, dispatch } = useContext(Store);
+
     const ADD_ONE_LENGHT = [""];
     const TOP_LABELS = ['ID', 'CRIAÇÃO EM', 'DESCRIÇÃO', 'STATUS', 'ATUALIZAÇÃO EM'] //Labels from Table  
 
@@ -87,6 +92,22 @@ const Questions = () => {
         })
     }
 
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false; 
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin')
+                    canUserEdit = true; 
+        }
+        else {
+            canUserEdit = false;
+        } 
+
+        return canUserEdit; 
+    }
+
     //handle load more items
     const LoadMoreItens = async (api) => {
         setIsLoadingMoreItems(true)
@@ -212,8 +233,8 @@ const Questions = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
-    } else {
+        return <LoadingSpinner text="Carregando..."/>
+    } else if(CheckUserPermission()){
         return (
             <>
                 <SnackBar
@@ -268,6 +289,7 @@ const Questions = () => {
                                             variant="contained"
                                             color="secondary"
                                             startIcon={<AddRoundedIcon />}
+                                            onClick={() => {currPage = 0}}
                                         >
                                             Novo
                                         </Button>
@@ -359,6 +381,6 @@ const Questions = () => {
                 </TableData>
             </>
         );
-    }
+    } else return <Unauthorized/>
 }
 export default Questions;
\ No newline at end of file
diff --git a/src/Admin/Pages/Pages/SubPages/Rating.js b/src/Admin/Pages/Pages/SubPages/Rating.js
index fd2bab6e..b16ddeab 100644
--- a/src/Admin/Pages/Pages/SubPages/Rating.js
+++ b/src/Admin/Pages/Pages/SubPages/Rating.js
@@ -34,6 +34,7 @@ import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
 //Local files
 import TableData from '../../../Components/Components/Table';
 import SnackBar from '../../../../Components/SnackbarComponent';
+import LoadingSpinner from '../../../../Components/LoadingSpinner';
 //Services
 import AlertDialog from "../../../Components/Components/AlertDialog";
 import { Url } from '../../../Filters';
@@ -201,7 +202,7 @@ const Ratings = () => {
     if (error) {
         return <div>Error: {error.message}</div>;
     } else if (!isLoaded) {
-        return <div>Loading...</div>;
+        return <LoadingSpinner text="Carregando..."/>
     } else {
 
         //Words in the top part of the table
diff --git a/src/Admin/Pages/Pages/SubPages/SendEmail.js b/src/Admin/Pages/Pages/SubPages/SendEmail.js
index e0e3e5f7..2ec61774 100644
--- a/src/Admin/Pages/Pages/SubPages/SendEmail.js
+++ b/src/Admin/Pages/Pages/SubPages/SendEmail.js
@@ -18,12 +18,14 @@ You should have received a copy of the GNU Affero General Public License
 along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>.*/
 
 
-import React from 'react';
+import React, {useContext} from 'react';
 import Card from "@material-ui/core/Card";
 import CardContent from "@material-ui/core/CardContent";
 import { makeStyles } from "@material-ui/core/styles";
-import { Typography } from '@material-ui/core'; 
+import { Typography } from '@material-ui/core';
 import EmailInputs from '../../../Components/Components/Inputs/EmailInputs';
+import { Store } from '../../../../Store';
+import Unauthorized from '../../../Components/Components/Unauthorized';
 
 const useStyles = makeStyles({
     root: {
@@ -45,7 +47,7 @@ const useStyles = makeStyles({
         display: "flex",
         flexDirection: "row",
         justifyContent: 'space-around',
-        alignItems: "center", 
+        alignItems: "center",
     },
     displayColumn: {
         display: "flex",
@@ -54,23 +56,42 @@ const useStyles = makeStyles({
     },
 });
 
-export { useStyles };
-const SendEmail = ({match}) => {
+const SendEmail = ({ match }) => {
+    const { state, dispatch } = useContext(Store);
     const classes = useStyles();
-    return (
-        <Card className={classes.root} variant="outlined">
-            <CardContent>
-                <Typography
-                    className={classes.title}
-                    color="inherit"
-                    gutterBottom
-                >
-                    Enviar email
-                </Typography> 
-                <EmailInputs email={`${match.params.email}`}/>
-            </CardContent>
-        </Card>
-    );
+
+    const CheckUserPermission = () => {
+        const roles = [...state.currentUser.roles];
+        let canUserEdit = false;
+
+        if (state.userIsLoggedIn) {
+            for (let i = 0; i < roles.length; i++)
+                if (roles[i].name === 'admin' || roles[i].name === 'editor')
+                    canUserEdit = true;
+        }
+        else {
+            canUserEdit = false;
+        }
+
+        return canUserEdit;
+    }
+
+    if(CheckUserPermission()){
+        return (
+            <Card className={classes.root} variant="outlined">
+                <CardContent>
+                    <Typography
+                        className={classes.title}
+                        color="inherit"
+                        gutterBottom
+                    >
+                        Enviar email
+                    </Typography>
+                    <EmailInputs email={`${match.params.email}`} />
+                </CardContent>
+            </Card>
+        );
+    } else return <Unauthorized/>
 }
 
 export default SendEmail; 
\ No newline at end of file
-- 
GitLab