mirror of https://github.com/portainer/portainer
fix(api): fix missing default Portainer permissions for users
parent
407328f9ed
commit
4349f5803c
|
@ -627,6 +627,23 @@ func main() {
|
||||||
Username: "admin",
|
Username: "admin",
|
||||||
Role: portainer.AdministratorRole,
|
Role: portainer.AdministratorRole,
|
||||||
Password: adminPasswordHash,
|
Password: adminPasswordHash,
|
||||||
|
PortainerAuthorizations: map[portainer.Authorization]bool{
|
||||||
|
portainer.OperationPortainerDockerHubInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointGroupList: true,
|
||||||
|
portainer.OperationPortainerEndpointList: true,
|
||||||
|
portainer.OperationPortainerEndpointInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionAdd: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionRemove: true,
|
||||||
|
portainer.OperationPortainerExtensionList: true,
|
||||||
|
portainer.OperationPortainerMOTD: true,
|
||||||
|
portainer.OperationPortainerRegistryList: true,
|
||||||
|
portainer.OperationPortainerRegistryInspect: true,
|
||||||
|
portainer.OperationPortainerTeamList: true,
|
||||||
|
portainer.OperationPortainerTemplateList: true,
|
||||||
|
portainer.OperationPortainerTemplateInspect: true,
|
||||||
|
portainer.OperationPortainerUserList: true,
|
||||||
|
portainer.OperationPortainerUserMemberships: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
err := store.UserService.CreateUser(user)
|
err := store.UserService.CreateUser(user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -100,6 +100,23 @@ func (handler *Handler) authenticateLDAPAndCreateUser(w http.ResponseWriter, use
|
||||||
user := &portainer.User{
|
user := &portainer.User{
|
||||||
Username: username,
|
Username: username,
|
||||||
Role: portainer.StandardUserRole,
|
Role: portainer.StandardUserRole,
|
||||||
|
PortainerAuthorizations: map[portainer.Authorization]bool{
|
||||||
|
portainer.OperationPortainerDockerHubInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointGroupList: true,
|
||||||
|
portainer.OperationPortainerEndpointList: true,
|
||||||
|
portainer.OperationPortainerEndpointInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionAdd: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionRemove: true,
|
||||||
|
portainer.OperationPortainerExtensionList: true,
|
||||||
|
portainer.OperationPortainerMOTD: true,
|
||||||
|
portainer.OperationPortainerRegistryList: true,
|
||||||
|
portainer.OperationPortainerRegistryInspect: true,
|
||||||
|
portainer.OperationPortainerTeamList: true,
|
||||||
|
portainer.OperationPortainerTemplateList: true,
|
||||||
|
portainer.OperationPortainerTemplateInspect: true,
|
||||||
|
portainer.OperationPortainerUserList: true,
|
||||||
|
portainer.OperationPortainerUserMemberships: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
err = handler.UserService.CreateUser(user)
|
err = handler.UserService.CreateUser(user)
|
||||||
|
|
|
@ -113,6 +113,23 @@ func (handler *Handler) validateOAuth(w http.ResponseWriter, r *http.Request) *h
|
||||||
user = &portainer.User{
|
user = &portainer.User{
|
||||||
Username: username,
|
Username: username,
|
||||||
Role: portainer.StandardUserRole,
|
Role: portainer.StandardUserRole,
|
||||||
|
PortainerAuthorizations: map[portainer.Authorization]bool{
|
||||||
|
portainer.OperationPortainerDockerHubInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointGroupList: true,
|
||||||
|
portainer.OperationPortainerEndpointList: true,
|
||||||
|
portainer.OperationPortainerEndpointInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionAdd: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionRemove: true,
|
||||||
|
portainer.OperationPortainerExtensionList: true,
|
||||||
|
portainer.OperationPortainerMOTD: true,
|
||||||
|
portainer.OperationPortainerRegistryList: true,
|
||||||
|
portainer.OperationPortainerRegistryInspect: true,
|
||||||
|
portainer.OperationPortainerTeamList: true,
|
||||||
|
portainer.OperationPortainerTemplateList: true,
|
||||||
|
portainer.OperationPortainerTemplateInspect: true,
|
||||||
|
portainer.OperationPortainerUserList: true,
|
||||||
|
portainer.OperationPortainerUserMemberships: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
err = handler.UserService.CreateUser(user)
|
err = handler.UserService.CreateUser(user)
|
||||||
|
|
|
@ -45,6 +45,23 @@ func (handler *Handler) adminInit(w http.ResponseWriter, r *http.Request) *httpe
|
||||||
user := &portainer.User{
|
user := &portainer.User{
|
||||||
Username: payload.Username,
|
Username: payload.Username,
|
||||||
Role: portainer.AdministratorRole,
|
Role: portainer.AdministratorRole,
|
||||||
|
PortainerAuthorizations: map[portainer.Authorization]bool{
|
||||||
|
portainer.OperationPortainerDockerHubInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointGroupList: true,
|
||||||
|
portainer.OperationPortainerEndpointList: true,
|
||||||
|
portainer.OperationPortainerEndpointInspect: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionAdd: true,
|
||||||
|
portainer.OperationPortainerEndpointExtensionRemove: true,
|
||||||
|
portainer.OperationPortainerExtensionList: true,
|
||||||
|
portainer.OperationPortainerMOTD: true,
|
||||||
|
portainer.OperationPortainerRegistryList: true,
|
||||||
|
portainer.OperationPortainerRegistryInspect: true,
|
||||||
|
portainer.OperationPortainerTeamList: true,
|
||||||
|
portainer.OperationPortainerTemplateList: true,
|
||||||
|
portainer.OperationPortainerTemplateInspect: true,
|
||||||
|
portainer.OperationPortainerUserList: true,
|
||||||
|
portainer.OperationPortainerUserMemberships: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
user.Password, err = handler.CryptoService.Hash(payload.Password)
|
user.Password, err = handler.CryptoService.Hash(payload.Password)
|
||||||
|
|
Loading…
Reference in New Issue