PublicDashboards: Accept AccessToken for pubdash creation (#74134)
* Add Access token input * add unit tests to access token * if else logic to not call find on empty string * update var naming
This commit is contained in:
@@ -155,6 +155,12 @@ func (api *Api) CreatePublicDashboard(c *contextmodel.ReqContext) response.Respo
|
||||
return response.Err(ErrInvalidUid.Errorf("CreatePublicDashboard: invalid Uid %s", uid))
|
||||
}
|
||||
|
||||
//validate accessToken
|
||||
accessToken := pdDTO.AccessToken
|
||||
if accessToken != "" && !validation.IsValidAccessToken(accessToken) {
|
||||
return response.Err(ErrInvalidAccessToken.Errorf("CreatePublicDashboard: invalid Access Token %s", accessToken))
|
||||
}
|
||||
|
||||
// Always set the orgID and userID from the session
|
||||
dto := &SavePublicDashboardDTO{
|
||||
UserId: c.UserID,
|
||||
|
||||
Reference in New Issue
Block a user