mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-09 20:00:12 +00:00
accounts: make all components of profile application optional
Basically, added the ability to -not- apply the profile's policy.
This commit is contained in:
parent
a136800ff2
commit
d60dea61db
10
api-users.go
10
api-users.go
@ -1372,7 +1372,9 @@ func (app *appContext) ApplySettings(gc *gin.Context) {
|
||||
configuration = profile.Configuration
|
||||
displayprefs = profile.Displayprefs
|
||||
}
|
||||
if req.Policy {
|
||||
policy = profile.Policy
|
||||
}
|
||||
if req.Ombi && app.config.Section("ombi").Key("enabled").MustBool(false) {
|
||||
if profile.Ombi != nil && len(profile.Ombi) != 0 {
|
||||
ombi = profile.Ombi
|
||||
@ -1394,7 +1396,9 @@ func (app *appContext) ApplySettings(gc *gin.Context) {
|
||||
return
|
||||
}
|
||||
applyingFrom = "\"" + user.Name + "\""
|
||||
if req.Policy {
|
||||
policy = user.Policy
|
||||
}
|
||||
if req.Homescreen {
|
||||
displayprefs, status, err = app.jf.GetDisplayPreferences(req.ID)
|
||||
if !(status == 200 || status == 204) || err != nil {
|
||||
@ -1421,10 +1425,14 @@ func (app *appContext) ApplySettings(gc *gin.Context) {
|
||||
app.debug.Println("Adding delay between requests for large batch")
|
||||
}
|
||||
for _, id := range req.ApplyTo {
|
||||
status, err := app.jf.SetPolicy(id, policy)
|
||||
var status int
|
||||
var err error
|
||||
if req.Policy {
|
||||
status, err = app.jf.SetPolicy(id, policy)
|
||||
if !(status == 200 || status == 204) || err != nil {
|
||||
errors["policy"][id] = fmt.Sprintf("%d: %s", status, err)
|
||||
}
|
||||
}
|
||||
if shouldDelay {
|
||||
time.Sleep(250 * time.Millisecond)
|
||||
}
|
||||
|
@ -101,6 +101,10 @@
|
||||
<div class="select ~neutral @low unfocused">
|
||||
<select id="modify-user-users"></select>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="modify-user-configuration" checked>
|
||||
<span>{{ .strings.applyConfigurationAndPolicy }}</span>
|
||||
</label>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="modify-user-homescreen" checked>
|
||||
<span>{{ .strings.applyHomescreenLayout }}</span>
|
||||
|
@ -81,6 +81,7 @@
|
||||
"useInviteExpiry": "Set expiry from profile/invite",
|
||||
"useInviteExpiryNote": "By default, invites expire after 90 days but can be renewed by the user. Enable for the referral to be disabled after the time set.",
|
||||
"applyHomescreenLayout": "Apply homescreen layout",
|
||||
"applyConfigurationAndPolicy": "Apply Jellyfin configuration/policy",
|
||||
"applyOmbi": "Apply Ombi profile (if available)",
|
||||
"applyJellyseerr": "Apply Jellyseerr profile (if available)",
|
||||
"sendDeleteNotificationEmail": "Send notification message",
|
||||
|
@ -178,6 +178,9 @@ type userSettingsDTO struct {
|
||||
Profile string `json:"profile"` // Name of profile (if from = "profile")
|
||||
ApplyTo []string `json:"apply_to"` // Users to apply settings to
|
||||
ID string `json:"id"` // ID of user (if from = "user")
|
||||
// Note confusing name: "Configuration" on the admin UI just means it in the sense
|
||||
// of the account's settings.
|
||||
Policy bool `json:"configuration"` // Whether to apply jf policy not
|
||||
Homescreen bool `json:"homescreen"` // Whether to apply homescreen layout or not
|
||||
Ombi bool `json:"ombi"` // Whether to apply ombi profile or not
|
||||
Jellyseerr bool `json:"jellyseerr"` // Whether to apply jellyseerr profile or not
|
||||
|
@ -795,7 +795,8 @@ export class accountsList {
|
||||
private _searchBox = document.getElementById("accounts-search") as HTMLInputElement;
|
||||
private _search: Search;
|
||||
|
||||
private _applyHomesreen = document.getElementById("modify-user-homescreen") as HTMLInputElement;
|
||||
private _applyHomescreen = document.getElementById("modify-user-homescreen") as HTMLInputElement;
|
||||
private _applyConfiguration = document.getElementById("modify-user-configuration") as HTMLInputElement;
|
||||
private _applyOmbi = document.getElementById("modify-user-ombi") as HTMLInputElement;
|
||||
private _applyJellyseerr = document.getElementById("modify-user-jellyseerr") as HTMLInputElement;
|
||||
|
||||
@ -1490,7 +1491,8 @@ export class accountsList {
|
||||
toggleLoader(button);
|
||||
let send = {
|
||||
"apply_to": list,
|
||||
"homescreen": this._applyHomesreen.checked,
|
||||
"homescreen": this._applyHomescreen.checked,
|
||||
"configuration": this._applyConfiguration.checked,
|
||||
"ombi": this._applyOmbi.checked,
|
||||
"jellyseerr": this._applyJellyseerr.checked
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user