= LSL: Authorization = == List of Users / Same Group == // Allow matching groups integer ALLOW_GROUP = TRUE; // A list of avatar keys (UUID) or usernames list AUTHORIZED_USERS = [ "6c8ff91f-d74b-4842-b38b-81bb08f6efde", // tomjs "bobka Resident", // fails "bobka.Resident", // fails "ernest.cone", // OK (angelus coen) "rebozuelo" // OK ]; // authorized(ID) // Return TRUE if: // * owner // * group matches object group // * key in AUTHORIZED_USERS // * name(key) in AUTHORIZED_USERS integer authorized(key id) { if (id == NULL_KEY || id == "") { // If no key given, fail auth return FALSE; } string username = llGetUsername(id); log("key->username: " + username); if (username == "") { // id is a prim id = llGetOwnerKey(id); log("new id: " + (string)id); } return ( id == llGetOwnerKey(llGetKey()) || (ALLOW_GROUP && llSameGroup(id)) || llListFindList(AUTHORIZED_USERS, [(string)id]) >= 0 || llListFindList(AUTHORIZED_USERS, [username]) >= 0 ); } log(string msg) { llOwnerSay(msg); } default { touch_start(integer total_number) { if (authorized(llDetectedKey(0))) { // do something authorized here log("allowed"); } else { log("DENIED!!"); } } listen(integer channel, string name, key id, string msg) { log("listen("+(string)channel+", "+name+", "+(string)id+", "+msg+")"); if (authorized(id)) { // Process our commands //command(msg, id); log("allowed"); } else { log("DENIED!!"); } } } == Touch and DetectedGroup == touch_start(integer num) { group = llDetectedGroup(0); // Is the Agent in the objectowner's group? agent = llDetectedKey(0); // Agent's key objectowner = llGetOwner(); // objowners key // is the Agent = the owner OR is the agent in the owners group if ((objectowner == agent) || (group && ingroup)) { // ... } }