mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-29 03:51:54 +08:00
fix: adjust default policies for system resources
This commit is contained in:
@@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
"yunion.io/x/sqlchemy"
|
||||
|
||||
@@ -243,7 +242,6 @@ func FetchUserInfo(ctx context.Context, data jsonutils.JSONObject) (mcclient.IId
|
||||
}
|
||||
|
||||
func FetchProjectInfo(ctx context.Context, data jsonutils.JSONObject) (mcclient.IIdentityProvider, error) {
|
||||
log.Debugf("FetchProjectInfo %s", data)
|
||||
tenantId, key := jsonutils.GetAnyString2(data, []string{"project", "project_id", "tenant", "tenant_id"})
|
||||
if len(tenantId) > 0 {
|
||||
data.(*jsonutils.JSONDict).Remove(key)
|
||||
|
||||
@@ -114,6 +114,18 @@ var (
|
||||
Action: PolicyActionGet,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "cloudproviders",
|
||||
Action: PolicyActionList,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "cloudproviders",
|
||||
Action: PolicyActionGet,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "cachedimages",
|
||||
@@ -174,6 +186,36 @@ var (
|
||||
Auth: true,
|
||||
Scope: rbacutils.ScopeUser,
|
||||
Rules: []rbacutils.SRbacRule{
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "keypairs",
|
||||
Action: PolicyActionGet,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "keypairs",
|
||||
Action: PolicyActionList,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "keypairs",
|
||||
Action: PolicyActionCreate,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "keypairs",
|
||||
Action: PolicyActionUpdate,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "compute",
|
||||
Resource: "keypairs",
|
||||
Action: PolicyActionDelete,
|
||||
Result: rbacutils.Allow,
|
||||
},
|
||||
{
|
||||
Service: "yunionconf",
|
||||
Resource: "parameters",
|
||||
|
||||
@@ -16,6 +16,7 @@ package httperrors
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"runtime/debug"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
@@ -50,6 +51,9 @@ func HTTPError(w http.ResponseWriter, msg string, statusCode int, class string,
|
||||
body.Add(err, "data")
|
||||
w.Write([]byte(body.String()))
|
||||
log.Errorf("Send error %s", err)
|
||||
if statusCode >= 500 {
|
||||
debug.PrintStack()
|
||||
}
|
||||
}
|
||||
|
||||
func JsonClientError(w http.ResponseWriter, e *httputils.JSONClientError) {
|
||||
|
||||
Reference in New Issue
Block a user