RBAC: Default to None role on SA creation if accesscontrol enabled (#77035)

* Check accesscontrol enabled on service account creation

* fix test

* linting
This commit is contained in:
Eric Leijonmarck
2023-10-24 13:52:55 +01:00
committed by GitHub
parent e08e884607
commit 813a7625a5
2 changed files with 2 additions and 2 deletions
@@ -83,7 +83,7 @@ describe('ServiceAccountCreatePage tests', () => {
await waitFor(() =>
expect(postMock).toHaveBeenCalledWith('/api/serviceaccounts/', {
name: 'Data source scavenger',
role: 'None',
role: 'Viewer',
})
);
});
@@ -29,7 +29,7 @@ export const ServiceAccountCreatePage = ({}: Props): JSX.Element => {
const [serviceAccount, setServiceAccount] = useState<ServiceAccountDTO>({
id: 0,
orgId: contextSrv.user.orgId,
role: OrgRole.None,
role: contextSrv.licensedAccessControlEnabled() ? OrgRole.None : OrgRole.Viewer,
tokens: 0,
name: '',
login: '',