Skip to content
Snippets Groups Projects
Commit 76556aff authored by rswindell's avatar rswindell
Browse files

Guest (G-restricted) accounts don't get persistent properties:

- always return the default value from the get() method
- always return true from the set() method (don't write anything)
Thanks to the anonymous YouTube BBS reviewer for highlighting this problem
(i.e. Minesweeper used the preferences of the last Guest user to run it)
parent 23005d74
Branches
Tags
No related merge requests found
// $Id$
require("userdefs.js", 'UFLAG_G');
function filename(usernum)
{
return system.data_dir + format("user/%04u.ini", usernum);
......@@ -7,8 +9,11 @@ function filename(usernum)
function get(section, key, deflt, usernum)
{
if(!usernum)
if(!usernum) {
usernum = user.number;
if(user.security.restrictions & UFLAG_G)
return deflt;
}
var file = new File(filename(usernum));
if(!file.open('r'))
return deflt;
......@@ -25,8 +30,11 @@ function get(section, key, deflt, usernum)
function set(section, key, value, usernum)
{
if(!usernum)
if(!usernum) {
usernum = user.number;
if(user.security.restrictions & UFLAG_G)
return true;
}
var file = new File(filename(usernum));
if(!file.open(file.exists ? 'r+':'w+'))
return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment