mirror of
https://github.com/grafana/grafana.git
synced 2024-11-23 09:26:43 -06:00
fix: remove migrated, and /org endpoint (#44788)
* fix: remove migrated, and /org endpoint * Update pkg/api/index.go
This commit is contained in:
parent
9e6b9215ab
commit
1dd2579528
@ -144,9 +144,8 @@ func (hs *HTTPServer) getAppLinks(c *models.ReqContext) ([]*dtos.NavLink, error)
|
||||
}
|
||||
|
||||
func enableServiceAccount(hs *HTTPServer, c *models.ReqContext) bool {
|
||||
return c.OrgRole == models.ROLE_ADMIN &&
|
||||
hs.Features.IsEnabled(featuremgmt.FlagServiceAccounts) &&
|
||||
hs.serviceAccountsService.Migrated(c.Req.Context(), c.OrgId)
|
||||
return (c.OrgRole == models.ROLE_ADMIN || (hs.Cfg.EditorsCanAdmin && c.OrgRole == models.ROLE_EDITOR)) &&
|
||||
hs.Features.IsEnabled(featuremgmt.FlagServiceAccounts)
|
||||
}
|
||||
|
||||
func enableTeams(hs *HTTPServer, c *models.ReqContext) bool {
|
||||
|
@ -13,19 +13,16 @@ var (
|
||||
Description: "encrypt secrets",
|
||||
State: FeatureStateBeta,
|
||||
},
|
||||
|
||||
{
|
||||
Name: "httpclientprovider_azure_auth",
|
||||
Description: "use http client for azure auth",
|
||||
State: FeatureStateBeta,
|
||||
},
|
||||
{
|
||||
Name: "service-accounts",
|
||||
Description: "support service accounts",
|
||||
State: FeatureStateBeta,
|
||||
RequiresLicense: true,
|
||||
Name: "service-accounts",
|
||||
Description: "support service accounts",
|
||||
State: FeatureStateBeta,
|
||||
},
|
||||
|
||||
{
|
||||
Name: "database_metrics",
|
||||
Description: "Add prometheus metrics for database tables",
|
||||
|
@ -47,7 +47,7 @@ func (api *ServiceAccountsAPI) RegisterAPIEndpoints(
|
||||
}
|
||||
|
||||
auth := acmiddleware.Middleware(api.accesscontrol)
|
||||
api.RouterRegister.Group("/api/org/serviceaccounts", func(serviceAccountsRoute routing.RouteRegister) {
|
||||
api.RouterRegister.Group("/api/serviceaccounts", func(serviceAccountsRoute routing.RouteRegister) {
|
||||
serviceAccountsRoute.Get("/", auth(middleware.ReqOrgAdmin, accesscontrol.EvalPermission(serviceaccounts.ActionRead, serviceaccounts.ScopeAll)), routing.Wrap(api.ListServiceAccounts))
|
||||
serviceAccountsRoute.Get("/:serviceAccountId", auth(middleware.ReqOrgAdmin, accesscontrol.EvalPermission(serviceaccounts.ActionRead, serviceaccounts.ScopeID)), routing.Wrap(api.RetrieveServiceAccount))
|
||||
serviceAccountsRoute.Delete("/:serviceAccountId", auth(middleware.ReqOrgAdmin, accesscontrol.EvalPermission(serviceaccounts.ActionDelete, serviceaccounts.ScopeID)), routing.Wrap(api.DeleteServiceAccount))
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
serviceaccountIDPath = "/api/org/serviceaccounts/%v"
|
||||
serviceaccountIDPath = "/api/serviceaccounts/%v"
|
||||
)
|
||||
|
||||
// test the accesscontrol endpoints
|
||||
|
@ -61,9 +61,3 @@ func (sa *ServiceAccountsService) DeleteServiceAccount(ctx context.Context, orgI
|
||||
}
|
||||
return sa.store.DeleteServiceAccount(ctx, orgID, serviceAccountID)
|
||||
}
|
||||
|
||||
func (sa *ServiceAccountsService) Migrated(ctx context.Context, orgID int64) bool {
|
||||
// TODO: implement migration logic
|
||||
// change this to return true for development of service accounts page
|
||||
return false
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import (
|
||||
type Service interface {
|
||||
CreateServiceAccount(ctx context.Context, saForm *CreateServiceaccountForm) (*models.User, error)
|
||||
DeleteServiceAccount(ctx context.Context, orgID, serviceAccountID int64) error
|
||||
Migrated(ctx context.Context, orgID int64) bool
|
||||
}
|
||||
|
||||
type Store interface {
|
||||
|
@ -32,7 +32,7 @@ const mapDispatchToProps = {
|
||||
|
||||
const connector = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
const ServiceAccountsListPage2: React.FC<Props> = ({ loadServiceAccounts, navModel, serviceAccounts, isLoading }) => {
|
||||
const ServiceAccountsListPage: React.FC<Props> = ({ loadServiceAccounts, navModel, serviceAccounts, isLoading }) => {
|
||||
const styles = useStyles2(getStyles);
|
||||
|
||||
useEffect(() => {
|
||||
@ -184,4 +184,4 @@ const getStyles = (theme: GrafanaTheme2) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connector(ServiceAccountsListPage2);
|
||||
export default connector(ServiceAccountsListPage);
|
||||
|
@ -3,7 +3,7 @@ import { getBackendSrv } from '@grafana/runtime';
|
||||
import { ServiceAccountDTO } from 'app/types';
|
||||
import { serviceAccountLoaded, serviceAccountsLoaded } from './reducers';
|
||||
|
||||
const BASE_URL = `/api/org/serviceaccounts`;
|
||||
const BASE_URL = `/api/serviceaccounts`;
|
||||
|
||||
export function loadServiceAccount(id: number): ThunkResult<void> {
|
||||
return async (dispatch) => {
|
||||
|
Loading…
Reference in New Issue
Block a user