diff --git a/imports/ui/Usuaris.jsx b/imports/ui/Usuaris.jsx
index 8873b5a..afadf0c 100644
--- a/imports/ui/Usuaris.jsx
+++ b/imports/ui/Usuaris.jsx
@@ -38,6 +38,30 @@ import { useNavigate, Link } from 'react-router-dom';
const U = ({u, esAdministrador}) => {
+ const [adm, setAdm] = useState(false);
+ const [mon, setMon] = useState(false);
+ const [enc, setEnc] = useState(false);
+ const [vol, setVol] = useState(false);
+
+ (async () => {
+ const esAdmin = await Roles.userIsInRoleAsync(u._id, ["admin"]);
+ setAdm(esAdmin);
+ const esMonit = await Roles.userIsInRoleAsync(u._id, ["monitor_de_poble"], {anyScope: true});
+ setMon(esMonit);
+ const esEncar = await Roles.userIsInRoleAsync(u._id, ["encarregat_de_tasques"], {anyScope: true});
+ setEnc(esEncar);
+ const esVolun = await Roles.userIsInRoleAsync(u._id, ["voluntari_de_poble"], {anyScope: true});
+ setVol(esVolun);
+ // setEsAdministrador(comprovaAdmin);
+ })();
+
+
+ // console.log("adm: ", adm);
+ // console.log("mon: ", mon);
+ // console.log("enc: ", enc);
+ // console.log("vol: ", vol);
+
+
// const [esAdministrador, setEsAdministrador] = useState(false);
// const u = useTracker("user", async () => await Meteor.userAsync());
@@ -109,11 +133,30 @@ const U = ({u, esAdministrador}) => {
}}
>
- { (u && esAdministrador) &&
ADMIN
}
+
+ { (u && adm) &&
ADMIN
}
+ { (u && mon) &&
mon
}
+ { (u && enc) &&
enc
}
+ { (u && vol) &&
vol
}
+
{
}, []);
// })();
+ // const [monitors, setMonitors] = useState(false);
+ // const [encarregats, setEncarregats] = useState(false);
+ // const [voluntaris, setVoluntaris] = useState(false);
+ // const [administradors, setAdministradors] = useState(false);
+
+ // let mon, mons, enc, encs, vol, vols;
+ // let
+ // administradors,
+ // monitors,
+ // encarregats,
+ // voluntaris
+ // ;
+
+
+ // (async () => {
+ // const admins = await Roles.getUsersInRoleAsync("administrador");
+ // // console.log("admins: ", admins);
+ // administradors = await admins?.fetchAsync();
+ // console.log("administradors: ", administradors);
+
+ // const mons = await Roles.getUsersInRoleAsync("monitor_de_poble");
+ // // console.log("mons: ", mons);
+ // monitors = await mons?.fetchAsync();
+ // console.log("monitors: ", monitors);
+
+ // const encs = await Roles.getUsersInRoleAsync("encarregat_de_tasques");
+ // // console.log("encs: ", encs);
+ // encarregats = await encs?.fetchAsync();
+ // console.log("encarregats: ", encarregats);
+
+ // const vols = await Roles.getUsersInRoleAsync("voluntari_de_poble");
+ // // console.log("vols: ", vols);
+ // voluntaris = await vols?.fetchAsync();
+ // console.log("voluntaris: ", voluntaris);
+ // })();
+
+
const QuadreInfo_Usuari = () => {
return {
}}
>
{/* {usr.username}{esEditor && } */}
-
+
)
}
;