修正:1. allowattach rbac compatible 2. server insert iso fail

This commit is contained in:
Qiu Jian
2019-01-09 10:27:30 +08:00
parent 3745065611
commit e3766653f6
2 changed files with 8 additions and 2 deletions
+7 -1
View File
@@ -154,7 +154,13 @@ func (dispatcher *DBJointModelDispatcher) Get(ctx context.Context, id1 string, i
}
func attachItems(dispatcher *DBJointModelDispatcher, master IStandaloneModel, slave IStandaloneModel, ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) {
if !dispatcher.JointModelManager().AllowAttach(ctx, userCred, master, slave) {
var isAllow bool
if consts.IsRbacEnabled() {
isAllow = isObjectRbacAllowed(master.GetModelManager(), master, userCred, policy.PolicyActionPerform, "attach")
} else {
isAllow = dispatcher.JointModelManager().AllowAttach(ctx, userCred, master, slave)
}
if !isAllow {
return nil, httperrors.NewForbiddenError("Not allow to attach")
}
ownerProjId, err := fetchOwnerProjectId(ctx, dispatcher.JointModelManager(), userCred, data)
+1 -1
View File
@@ -313,7 +313,7 @@ func (self *SKVMGuestDriver) RequestGuestCreateAllDisks(ctx context.Context, gue
}
func (self *SKVMGuestDriver) RequestGuestHotAddIso(ctx context.Context, guest *models.SGuest, path string, task taskman.ITask) error {
return guest.StartSyncstatus(ctx, task.GetUserCred(), task.GetTaskId())
return guest.StartSyncTask(ctx, task.GetUserCred(), false, task.GetTaskId())
}
func (self *SKVMGuestDriver) RequestRebuildRootDisk(ctx context.Context, guest *models.SGuest, task taskman.ITask) error {