permissions utilities #42

Parent #79Owner #2Flags obsolete1, readSource QuestCore.db

Aliases: permissions utilities, Generic Utilities Package

4 verbs · 5 properties · 0 children

Verbs

VerbSpecFlagsDefinerLines
controlsthis none thisrxd#423
applythis none thisrxd#4222
callerthis none thisrxd#426
controls_prop*erty controls_verbthis none thisrxd#427

Properties

PropertyDefinerFlagsOwnerValue
help_msg#79rc#2
list of 16{"Miscellaneous routines for permissions checking", "", "For a complete description of a given verb, do `help $perm_utils:verbname'", "", ":controls(who,what) -- can who write on object what", ":controls_property(who,what,propname) -- can who write on what.propname", "These routines check write flags and also the wizardliness of `who'.", "", "(these last two probably belong on $code_utils)", "", ":apply(permstring,mods)", " -- used by @chmod to apply changes (e.g., +x) ", " to a given permissions string", "", ":caller()", " -- returns the first caller in the callers() stack distinct from `this'"}
key#1c#2<clear>
aliases#1rc#2{"permissions utilities", "Generic Utilities Package"}
description#1rc#2{"This is the permissions utilities utility package. See `help $perm_utils' for more details."}
object_size#1r#36{3372, 1539462952}

Ancestry

Ancestors (nearest first): #79 Generic Utilities Package#1 Root Class

Children: none

Source

controls

Spec this none thisFlags rxdOwner #2Definer #42

Referenced by

Source

1"$perm_utils:controls(who, what)";
2"Is WHO allowed to hack on WHAT?";
3return (args[1] == args[2].owner) || args[1].wizard;

apply

Spec this none thisFlags rxdOwner #36Definer #42

Referenced by

Source

1":apply(permstring,mods) => new permstring.";
2"permstring is a permissions string, mods is a concatenation of strings of the form +<letters>, !<letters>, or -<letters>, where <letters> is a string of letters as might appear in a permissions string (`+' adds the specified permissions, `-' or `!' removes them; `-' and `!' are entirely equivalent).";
3{perms, mods} = args;
4if ((!mods) || (!index("!-+", mods[1])))
5return mods;
6endif
7i = 1;
8while (i <= length(mods))
9if (mods[i] == "+")
10while (((i = i + 1) <= length(mods)) && (!index("!-+", mods[i])))
11if (!index(perms, mods[i]))
12perms = perms + mods[i];
13endif
14endwhile
15else
16"mods[i] must be ! or -";
17while (((i = i + 1) <= length(mods)) && (!index("!-+", mods[i])))
18perms = strsub(perms, mods[i], "");
19endwhile
20endif
21endwhile
22return perms;

caller

Spec this none thisFlags rxdOwner #2Definer #42

Referenced by

none

Source

1stage = 1;
2{?lineno = 0} = args;
3c = callers(lineno);
4while (((stage = stage + 1) < length(c)) && (c[stage][1] == c[1][1]))
5endwhile
6return c[stage];

controls_prop*erty controls_verb

Spec this none thisFlags rxdOwner #2Definer #42

Referenced by

none

Source

1"Syntax:  controls_prop(OBJ who, OBJ what, STR propname)   => 0 | 1";
2"         controls_verb(OBJ who, OBJ what, STR verbname)   => 0 | 1";
3"";
4"Is WHO allowed to hack on WHAT's PROPNAME? Or VERBNAME?";
5{who, what, name} = args;
6bi = (verb == "controls_verb") ? "verb_info" | "property_info";
7return who.wizard || (who == call_function(bi, what, name)[1]);