fix: region statusstandalone resource get status api missing

This commit is contained in:
Zexi
2019-04-17 21:08:38 +08:00
parent 8460d58e9a
commit c724a216a3
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -77,3 +77,13 @@ func (model *SStatusStandaloneResourceBase) PerformStatus(ctx context.Context, u
func (model *SStatusStandaloneResourceBase) IsInStatus(status ...string) bool {
return utils.IsInStringArray(model.Status, status)
}
func (model *SStatusStandaloneResourceBase) AllowGetDetailsStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool {
return IsAdminAllowGetSpec(userCred, model, "status")
}
func (model *SStatusStandaloneResourceBase) GetDetailsStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error) {
ret := jsonutils.NewDict()
ret.Add(jsonutils.NewString(model.Status), "status")
return ret, nil
}
+4
View File
@@ -183,6 +183,10 @@ func (model *SVirtualResourceBase) AllowPerformMetadata(ctx context.Context, use
return model.IsOwner(userCred) || IsAdminAllowPerform(userCred, model, "metadata")
}
func (model *SVirtualResourceBase) AllowGetDetailsStatus(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) bool {
return model.IsOwner(userCred) || IsAdminAllowGetSpec(userCred, model, "status")
}
func (model *SVirtualResourceBase) GetTenantCache(ctx context.Context) (*STenant, error) {
// log.Debugf("Get tenant by Id %s", model.ProjectId)
return TenantCacheManager.FetchTenantById(ctx, model.ProjectId)