Skip to content

Commit 31710c0

Browse files
committed
fix: remove "This feature is unavailable in this sign-in mode" checks
1 parent aecfa28 commit 31710c0

8 files changed

Lines changed: 14 additions & 40 deletions

File tree

controllers/message.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,12 @@ func (c *ApiController) UpdateMessage() {
208208
}
209209

210210
if message.NeedNotify {
211-
if !conf.IsCasdoorAvailable() {
212-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
213-
return
214-
}
215-
216-
err = message.SendEmail(c.GetAcceptLanguage())
217-
if err != nil {
218-
c.ResponseError(err.Error())
219-
return
211+
if conf.IsCasdoorAvailable() {
212+
err = message.SendEmail(c.GetAcceptLanguage())
213+
if err != nil {
214+
c.ResponseError(err.Error())
215+
return
216+
}
220217
}
221218

222219
message.NeedNotify = false

controllers/message_answer.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,6 @@ func (c *ApiController) GetMessageAnswer() {
360360
message.Price = model.AddPrices(message.Price, 0)
361361

362362
// Add transaction for message with price
363-
if message.Price > 0 && !conf.IsCasdoorAvailable() {
364-
c.ResponseErrorStream(message, c.T("auth:This feature is unavailable in this sign-in mode"))
365-
return
366-
}
367363
err = object.AddTransactionForMessage(message)
368364
if err != nil {
369365
c.ResponseErrorStream(message, err.Error())

controllers/permission.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (c *ApiController) GetPermission() {
8181
// @router /update-permission [post]
8282
func (c *ApiController) UpdatePermission() {
8383
if !conf.IsCasdoorAvailable() {
84-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
84+
c.ResponseOk(true)
8585
return
8686
}
8787

@@ -109,7 +109,7 @@ func (c *ApiController) UpdatePermission() {
109109
// @router /add-permission [post]
110110
func (c *ApiController) AddPermission() {
111111
if !conf.IsCasdoorAvailable() {
112-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
112+
c.ResponseOk(true)
113113
return
114114
}
115115

@@ -138,7 +138,7 @@ func (c *ApiController) AddPermission() {
138138
// @router /delete-permission [post]
139139
func (c *ApiController) DeletePermission() {
140140
if !conf.IsCasdoorAvailable() {
141-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
141+
c.ResponseOk(true)
142142
return
143143
}
144144

controllers/resource.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"strings"
2424

2525
"github.com/beego/beego/utils/pagination"
26-
"github.com/the-open-agent/openagent/conf"
2726
"github.com/the-open-agent/openagent/object"
2827
"github.com/the-open-agent/openagent/util"
2928
)
@@ -190,11 +189,6 @@ func (c *ApiController) UploadResourceFile() {
190189
return
191190
}
192191

193-
if !conf.IsCasdoorAvailable() {
194-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
195-
return
196-
}
197-
198192
category := c.GetString("category")
199193
objectType := c.GetString("objectType")
200194
objectId := c.GetString("objectId")
@@ -297,11 +291,6 @@ func (c *ApiController) UploadFile() {
297291

298292
filePath := fmt.Sprintf("openagent/resources/%s/%s/%s", category, userName, fileName)
299293

300-
if !conf.IsCasdoorAvailable() {
301-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
302-
return
303-
}
304-
305294
fileUrl, storageName, err := object.UploadFileToStorageSafe(userName, "file", "UploadFile", filePath, fileBytes)
306295
if err != nil {
307296
c.ResponseError(err.Error())

controllers/store.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,9 @@ func (c *ApiController) AddSharedStore() {
463463
c.ResponseError(err.Error())
464464
return
465465
}
466-
if accountUser == nil {
467-
if !conf.IsCasdoorAvailable() {
468-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
469-
return
470-
}
466+
if accountUser == nil && !conf.IsCasdoorAvailable() {
467+
c.ResponseError(c.T("general:Target user not found"))
468+
return
471469
}
472470

473471
newStore, err := object.ShareStore(src.Owner, src.Name, form.TargetUser, c.GetSessionUsername())

controllers/task_upload.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"strings"
2222

2323
"github.com/beego/beego/logs"
24-
"github.com/the-open-agent/openagent/conf"
2524
"github.com/the-open-agent/openagent/object"
2625
"github.com/the-open-agent/openagent/txt"
2726
)
@@ -100,11 +99,6 @@ func (c *ApiController) UploadTaskDocument() {
10099
}
101100

102101
// Upload file to storage
103-
if !conf.IsCasdoorAvailable() {
104-
c.ResponseError(c.T("auth:This feature is unavailable in this sign-in mode"))
105-
return
106-
}
107-
108102
filePath := fmt.Sprintf("openagent/task-documents/%s/%s", userName, fileName)
109103
fileUrl, storageName, err := object.UploadFileToStorageSafe(userName, "file", "UploadTaskDocument", filePath, fileBytes)
110104
if err != nil {

i18n/locales/en/data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"Invalid username or password": "Invalid username or password",
2424
"Please sign in first": "Please sign in first",
2525
"Sign in is unavailable": "Sign in is unavailable",
26-
"This feature is unavailable in this sign-in mode": "This feature is unavailable in this sign-in mode",
2726
"Unauthorized operation": "Unauthorized operation",
2827
"this operation requires admin privilege": "this operation requires admin privilege"
2928
},
@@ -97,6 +96,7 @@
9796
},
9897
"general": {
9998
"Failed to update": "Failed to update",
99+
"Target user not found": "Target user not found",
100100
"The task does not exist": "The task does not exist"
101101
},
102102
"message_answer": {

i18n/locales/zh/data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"Invalid username or password": "用户名或密码错误",
2424
"Please sign in first": "请先登录",
2525
"Sign in is unavailable": "登录不可用",
26-
"This feature is unavailable in this sign-in mode": "当前登录方式不支持此功能",
2726
"Unauthorized operation": "未授权的操作",
2827
"this operation requires admin privilege": "此操作需要管理员权限"
2928
},
@@ -97,6 +96,7 @@
9796
},
9897
"general": {
9998
"Failed to update": "更新失败",
99+
"Target user not found": "目标用户不存在",
100100
"The task does not exist": "任务不存在"
101101
},
102102
"message_answer": {

0 commit comments

Comments
 (0)