mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: WebDAV mount folders
This commit is contained in:
27
service/user/setting.go
Normal file
27
service/user/setting.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package user
|
||||
|
||||
import (
|
||||
model "github.com/HFO4/cloudreve/models"
|
||||
"github.com/HFO4/cloudreve/pkg/serializer"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// SettingService 通用设置服务
|
||||
type SettingService struct {
|
||||
}
|
||||
|
||||
// Policy 获取用户存储策略设置
|
||||
func (service *SettingService) Policy(c *gin.Context, user *model.User) serializer.Response {
|
||||
// 取得用户可用存储策略
|
||||
available := make([]model.Policy, 0, len(user.Group.PolicyList))
|
||||
for _, id := range user.Group.PolicyList {
|
||||
if policy, err := model.GetPolicyByID(id); err == nil {
|
||||
available = append(available, policy)
|
||||
}
|
||||
}
|
||||
|
||||
// 取得用户当前策略
|
||||
current := user.Policy
|
||||
|
||||
return serializer.BuildPolicySettingRes(available, ¤t)
|
||||
}
|
||||
Reference in New Issue
Block a user