external next up previous contents index
Next: More on Permissions Up: Elements of the MOO Previous: 10.6 Expressionsstatements, commands,

10.7 Permissions (by Defender)

   

Acknowledgement: This text is a formatted version of a message posted to *programmers on (now defunct) Worldmoo on Sat Mar 4 07:50:23 1995 PST by Defender (#160)

  1. Every object, verb, and property has an owner.
  2. Verbs are executed with a 'set of permissions', or a flag indicating which player owns the task. Any verb you write will normally run with your permissions, which means it can affect things you own. Wizards can use a built-in function called set_task_perms(), documented, to change the permissions of a particular verb's execution. This doesn't change the verb ownership, nor does it change permissions for other verbs. Normally you don't need to worry about that.
  3. A verb with the permissions of the owner of something, or a wizard's permissions, can affect that something (read its value or write to it). For instance, you can create verbs and properties on objects you own, because the creative verbs run with your permissions.
  4. Everything (objects, verbs, and properties) have a set of possible 'permission bits', which control access to them. Two of these potential bits are always R and W (for Readable and Writable). For verbs whose permissions aren't the owner and aren't wizardly, these flags are important.
  5. If the R bit for something is set, any set of permissions can read it. For example, if a verb you write has its R bit set, anybody can read the verb code. If it is not set, the object/verb/property is said to be "E_PERM'ed", referring to the error code E_PERM (Permission Denied), which will be returned upon attempts to read the value. Unless you are deliberately needing to hide some information, it is good practice to make things readable by setting the R bit.
  6. If the W bit for something is set, any set of permissions can write to it. For example, if you have a property whose W bit is set, anybody can set the property value to anything they want, or remove it altogether. The W bit is almost never set, and should NOT be set for verbs in particular.
  7. What reading and writing mean depends on what you are dealing with.
            WHAT READABILITY MEANS      WHAT WRITABILITY MEANS
Objects:    You can use verbs() and     You can define your own verbs
            properties() directly to    and properties on the object,
            read the list of verbs and  which will be owned by you.
            properties directly.
Verbs:      You can use verb_info(),    You can change the arguments,
            verb_args(), and            names, and program code for the
            verb_code() on the verb,    verb in question, using @edit
            and you can @list the code. for example.
Properties: You can see the permissions You can change the permissions
            and value for the property. and value for the property.




next up previous contents index external
Next: More on Permissions Up: Elements of the MOO Previous: 10.6 Expressionsstatements, commands,

Daniel K. Schneider
Thu Apr 17 12:43:52 MET DST 1997