diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a1270711..16e1cbfa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Latest changes in each category go to the top ## [Unreleased] ### Added +- dev_login can change userId when clicking on the user in the upper right +- admin can now add users as voters - New debugging variables in [local_vars.sh](./scripts/local_vars.sh) - Changelog - please use it diff --git a/web/backend/src/authManager.ts b/web/backend/src/authManager.ts index 4df3c1dee..9593ce9f1 100644 --- a/web/backend/src/authManager.ts +++ b/web/backend/src/authManager.ts @@ -50,11 +50,7 @@ export function isAuthorized(sciper: number | undefined, subject: string, action } export async function getUserPermissions(userID: number) { - let permissions: string[][] = []; - await authEnforcer.getFilteredPolicy(0, String(userID)).then((authRights) => { - permissions = authRights; - }); - return permissions; + return authEnforcer.getFilteredPolicy(0, String(userID)); } export async function addPolicy(userID: string, subject: string, permission: string) { diff --git a/web/frontend/src/pages/form/components/ActionButtons/VoteButton.tsx b/web/frontend/src/pages/form/components/ActionButtons/VoteButton.tsx index a36afbb64..ce027a92f 100644 --- a/web/frontend/src/pages/form/components/ActionButtons/VoteButton.tsx +++ b/web/frontend/src/pages/form/components/ActionButtons/VoteButton.tsx @@ -7,10 +7,12 @@ import { ROUTE_BALLOT_SHOW } from 'Routes'; import { Status } from 'types/form'; const VoteButton = ({ status, formID }) => { + const authCtx = useContext(AuthContext); const { isLogged } = useContext(AuthContext); const { t } = useTranslation(); return ( + authCtx.isAllowed(formID, 'vote') && status === Status.Open && isLogged && (