Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
security_tech_notes [2007/03/29 20:09]
Glarawyn Added case conventions, found a couple typos. Used spellcheck.
security_tech_notes [2013/09/12 22:49] (current)
Line 1: Line 1:
-====== BeBot'​s Security Management System ====== 
- 
-=== Introduction === 
-BeBot'​s Security Management System aims to provide a common interface and structure for dealing with all things security. This document provides a technical specification and my notes for the developer(s) of BeBot'​s security system. ​ 
- 
 === Access Levels === === Access Levels ===
-The core of BeBot security is the Access Level. An Access Level is a defined constant that cannot be changed. Access Levels are not groups, even though the SUPERADMIN, ADMIN, and LEADER access levels have the same names as BeBot'​s default security groups. ​ 
- 
 BeBot has 8 Access Levels: BeBot has 8 Access Levels:
   - OWNER (Bot Owner)   - OWNER (Bot Owner)
Line 16: Line 9:
   - ANONYMOUS (Someone who is not a guest or member, but sends a tell to the bot.)   - ANONYMOUS (Someone who is not a guest or member, but sends a tell to the bot.)
   - BANNED (Someone who has been banned.)   - BANNED (Someone who has been banned.)
- 
-All access is defined by these eight levels. ​ 
  
 === Access Levels and Group Conventions === === Access Levels and Group Conventions ===
Line 40: Line 31:
  
 If any value is outside the valid range (A value less than -1 or greater than 256) is discovered, the function will return -1 banned as something seems to have gone wrong. (Tampering in the database, or editing the code to change defined access levels.) If any value is outside the valid range (A value less than -1 or greater than 256) is discovered, the function will return -1 banned as something seems to have gone wrong. (Tampering in the database, or editing the code to change defined access levels.)
- 
-=== Using the Security System in your modules === 
-To make security easy for module developers, the check_access function provides all the security checks you will need. When assigning security to commands, you should **always** use one of the eight access levels, not security groups. This allows the bot user full flexibility with their configuration as org ranks and custom security groups are assigned access levels. ​ 
- 
-For example, your module should only be used by bot leaders. You would use the following code: 
-<code php> 
-if ($this -> bot -> security -> check_access($playername,​ "​LEADER"​)) 
-    return "You are a LEADER or higher on <​botname>​!";​ 
-else 
-    return "You are not a LEADER or higher on <​botname>";​ 
-</​code>​ 
- 
-check_access returns TRUE if the player meets or exceeds the level you are checking. A player with an access level of LEADER, ADMIN, SUPERADMIN, or OWNER all meet or exceed the LEADER requirement. ​ 
  
 === Security Cache Array === === Security Cache Array ===
Line 66: Line 44:
 $this -> cache['​orgranks'​][$rank_name] = INT; // access level $this -> cache['​orgranks'​][$rank_name] = INT; // access level
 </​code>​ </​code>​
- 
-=== Security Cache Management === 
-The cache_mgr($action,​ $cache, $info, $more) function is used to add and remove information from the security cache. The cache manager function should only be called by functions that are modifying security (adding users, groups, changing group membership, etc.) 
- 
-Description of function parameters: 
-$action: add or rem 
-$cache: Which cache to modify (groups, guests, members, banned, groupmem, orgranks) 
-$info: The information to add (or remove) 
-$more: Extra information needed for some actions. (Optional Parameter) 
- 
-Examples: 
-  * Add and remove a guest: 
-<code php> 
-$this -> cache_mgr("​add",​ "​guests",​ "​Glarawyn"​);​ 
-$this -> cache_mgr("​rem",​ "​guests",​ "​Glarawyn"​);​ 
-</​code>​ 
-  * Add and remove a member: 
-<code php> 
-$this -> cache_mgr("​add",​ "​members",​ "​Glarawyn"​);​ 
-$this -> cache_mgr("​rem",​ "​members",​ "​Glarawyn"​);​ 
-</​code>​ 
-  * Add and remove a ban: 
-<code php> 
-$this -> cache_mgr("​add",​ "​banned",​ "​Glarawyn"​);​ 
-$this -> cache_mgr("​rem",​ "​banned",​ "​Glarawyn"​);​ 
-</​code>​ 
-  * Add a group: ​ 
-<code php> 
-$tmp = array("​gid"​ => "​10",​ "​name"​ => "​groupname",​ "​description"​ = "​Example Group",​ "​access_level"​ => 2); 
-$this -> cache_mgr("​add",​ "​groups",​ $tmp); 
-</​code>​ 
-  * Remove a group: ​ 
-<code php> 
-$this -> cache_mgr("​rem",​ "​groups",​ $groupname);​ 
-</​code>​ 
-  * Add and remove a group member: 
-<code php> 
-$this -> cache_mgr("​add",​ "​groupmem",​ $groupname, $membername);​ 
-$this -> cache_mgr("​rem",​ "​groupmem",​ $groupname, $membername);​ 
-</​code>​ 
-  * Change an org rank's access level: 
-<code php> 
-$this -> cache_mgr("​add",​ "​orgrank",​ "​President",​ "​255"​);​ 
-</​code>​ 
- 
-=== Security Module Functions === 
-Add a group: 
-<code php> 
-add_group($groupname,​ $description);​ 
-</​code>​ 
- 
-Delete a group: ​ 
-<code php> 
-del_group($target);​ 
-</​code>​ 
- 
-Add a user to a group: 
-<code php> 
-add_group_member($target,​ $group) 
-</​code>​ 
- 
-Remove a user from a group: 
-<code php> 
-del_group_member($target,​ $group) 
-</​code>​ 
- 
-Add a member or guest: 
-<code php> 
-add_user($admin,​ $target, $level="​guest"​) 
-</​code>​ 
- 
-Remove a member or guest: 
-<code php> 
-del_user($admin,​ $target) 
-</​code>​ 
- 
-Set a ban: 
-<code php> 
-set_ban($admin,​ $target) 
-</​code>​ 
- 
-Remove a ban: 
-<code php> 
-rem_ban($admin,​ $target) 
-</​code>​ 
- 
-Get group id (returns -1 if group doesn'​t exisit) 
-<code php> 
-get_gid($groupname) 
-</​code>​ 
- 
- 
 
security_tech_notes.txt ยท Last modified: 2013/09/12 22:49 (external edit)
[unknown button type]
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
WikiForumIRCBugs
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki