Method code for $root.perms()

[Turn on line numbering]
arg what, @args;
var flag;

if (!args)
    args = ['writer];
if (type(args[1]) == 'symbol) {
    switch (args[1]) {
        case 'system:
            if (!$sys.is_system(what))
                throw(~perm, "Permission Denied: " + what + " is not of the system.", what);
        case 'manager:
            if (.manager() != what && !$sys.is_system(what))
                throw(~perm, "Permission Denied: " + what + " is not the manager.", what);
        case 'trusts:
            if (!.trusts(what))
                throw(~perm, "Permission Denied: " + what + " is not a trustee.", what);
        case 'command:
            if (what != $user && what != $body)
                throw(~perm, what + " is not a valid command invoking object.");
        default:
            if (!.is_writable_by(what))
                throw(~perm, "Permission Denied: " + what + " is not a writer.", what);
    }
} else if (type(what) == 'objnum) {
    if (!(what in args))
        throw(~perm, what + " is not one of: " + args.mmap('namef, 'ref).to_english(), what);
}

["// Created as a part of ColdCore, see: @help Credit"]

the Cold Dark