Website:Groups
From MatureAsskickers Wiki
Contents |
Groups Table
The groups table stores all of the group data. This data is used for Session permissions, HTTP authentication, FTP authentication, and Sendmail aliases.
Data Structure
Fields
- groupid
- datetime_insert
- datetime_update
- datetime_expire
- groupname (mandatory)
- hostname (mandatory)
- groupalias
- ftpchroot
- httproot
- grouppermissions
- users
- data
Descriptions
groupid
- (integer, unique)
- A unique identification number for the group. No other group will have the same number and it is used to refer to the group from other table's. This value is assigned when the group is created and is read-only.
- Read Permission: groups.read.groupid (all)
- Write Permission: groups.write.groupid (none)
datetime_insert
- (YYYY-MM-DD hh:mm:ss)
- The timestamp of when the group was created. This value is assigned when the group is created and is read-only.
- Read Permission: groups.read.datetime_insert (all)
- Write Permission: groups.write.datetime_insert (none)
datetime_update
- (YY-MM-DD hh:mm:ss)
- The timestamp of when the group was last edited. This value is automatically handled and is read-only.
- Read Permission: groups.read.datetime_update (all)
- Write Permission: groups.write.datetime_update (none)
datetime_expire
- (YY-MM-DD hh:mm:ss)
- The timestamp of when the group has/will expire. Once the current date-time has surpassed this value the group is effectively deleted, however the group can still be edited. Expiring a group will disable HTTP authentication and FTP authentication, Sendmail aliases, and general display within XML feeds.
- Read Permission: groups.read.datetime_expire (defined, self)
- Write Permission: groups.write.datetime_expire (defined)
groupname
- (string, 2-80 characters, alpha-numeric [a-z0-9])
- This is a unique name for each group. No other group, recruit or user can use the same name. It is a mandatory field when adding a new group and when cannot be made empty when editing a group. This value is used for HTTP authentication and FTP authentication.
- Read Permission: groups.read.groupname (all)
- Write Permission: groups.write.groupname (defined, self)
- See HTTP Authentication, FTP Authentication
hostname
- (string, 'group.domain.com' format)
- This is the groups domain or subdomain name. It must either be the current domain, or a sub-domain of the current domain. This value must either be the current domain or a subdomain of the current domain. For example, if the current domain is sub.domain.com, the hostname value must either also be sub.domain.com or something.sub.domain.com. It is a mandatory field when adding a new group and cannot be made empty when editing a group. This value is used for HTTP authentication, FTP authentication and Session permissions.
- Read Permission: groups.read.hostname (defined, self)
- Write Permission: groups.write.hostname (defined, self)
- See Sendmail Aliases
groupalias
- (string, 2-80 characters, alpha-numeric [a-z0-9])
- This is a unique name for each group. No other group, recruit or user can use the same name. It is an optional field when adding a new group and can be made empty when editing a group. This value is used for Sendmail aliases.
- Read Permission: groups.read.groupalias (defined)
- Write Permission: groups.write.groupalias (defined)
- See Sendmail Aliases
ftpchroot
- (string, 0-255 characters)
- This is the server's path to the groups FTP home directory. It is an optional field when adding a new group and can be made empty when editing a group. The path must reside within the jail directory defined in the configuration file. This value is used for FTP access.
- Read Permission: groups.read.ftpchroot (defined)
- Write Permission: groups.write.ftpchroot (defined)
- See HTTP Authentication, FTP Authentication
httproot
- (string, 0-255 characters)
- This is the server's path to the groups HTTP home directory. It is an optional field when adding a new group and can be made empty when editing a group. The path must reside within the jail directory defined in the configuration file. This value is used for HTTP access.
- Read Permission: groups.read.httproot (defined)
- Write Permission: groups.write.httproot (defined)
grouppermissions
- (string)
- This is a CSV (comma separated values) of the group's granted permissions. The permissions granted are global and effective for all users or this group.
- Read Permission: groups.read.grouppermissions (defined)
- Write Permission: groups.write.grouppermissions (defined)
- See Permissions
users
- (array)
- This is an array of the group's users. It is an optional field and can be made empty when editing the group.
- AKA (Also Known As) groupusers which is synonymous with usergroups.
- Read Permission: groups.read.users (defined)
- Write Permission: groups.write.users (defined)
- See Users, HTTP Authentication, FTP Authentication
data
- (array)
- This is special array of custom unreserved key value pairs. It is an optional field and any groups.data.* value can be made empty when editing a group.
- Read Permission: groups.read.data (all)
- Write Permission: groups.write.data (defined, self)
- See Custom Data
Reading Data
See XML Data
XML
Sample XML output
/xml/groups.xml
<?xml version = "1.0" encoding="UTF-8" standalone="yes"?>
<groups>
<group id="1">
<groupid>1</groupid>
<datetime_insert>2006-10-10 07:55:29</datetime_insert>
<datetime_update>2007-02-19 19:02:14</datetime_update>
<datetime_expire>2008-08-05 12:00:00</datetime_expire>
<groupname>Team</groupname>
<hostname>team.domain.com</hostname>
<groupalias>team</groupalias>
<ftpchroot>/home/team/html/files</ftpchroot>
<httproot>/home/team/html</httproot>
<grouppermissions>
<csv><![CDATA[ ftp.read.group ]]></csv>
<ftp.read.group>1</ftp.read.group>
</grouppermissions>
<users>
<user id="1">
<username>Player1</username>
</user>
<user id="2">
<username>Player2</username>
</user>
<user id="3">
<username>Player3</username>
</user>
</users>
<data>
<key>value</key>
<...>...</...>
</data>
</group>
<group id="...">
...
</group>
</groups>
The Request
The following url keys can be used in the HTTP GET request to filter and/or sort the XML.
- groupid (default all) - Filter by a single groupid or CSV of multiple groupid's.
/xml/groups.xml?groupid=1,2,3
- userids (default all) - Filter by a single userid or CSV of multiple userid's.
/xml/groups.xml?userids=1,2,3
- expired (default 0) - Filter by 0 for non-expired, 1 for expired.
/xml/groups.xml?expired=1
Writing Data
HTTP POST
See HTTP POST Data
Adding a group (_group_add)
- Permissions required: groups.write.groupname (defined)
A simple example of adding a new group.
<form action="/xml/httppost.xml" method="post"> <input type="hidden" name="_action" value="_group_add"> groupname: <input type="text" name="groupname"> <input type="submit" value="add"> </form>
Editing a group (_group_edit)
- Permissions required: groups.write.groupname (defined)
A simple example of adding a group.
<form action="/xml/httppost.xml" method="post"> <input type="hidden" name="_action" value="_group_edit"> <input type="hidden" name="groupid" value="99"> groupname: <input type="text" name="groupname" value="Player"> <input type="submit" value="edit"> </form>
Deleting a group (_group_delete)
- Permissions required: groups.delete (defined)
A simple example of deleting a group.
<form action="/xml/httppost.xml" method="post"> <input type="hidden" name="_action" value="_group_delete"> <input type="hidden" name="groupid" value="99"> <input type="submit" value="delete"> </form>
Editing a group's users (_group_edit_users)
- Permissions required: groups.write.users (defined)
A simple example of editing a group's users using CSV (comma separated values) of userid's.
<form action="/xml/httppost.xml" method="post"> <input type="hidden" name="_action" value="_group_edit_users"> <input type="hidden" name="groupid" value="99"> <input type="text" name="users" value="1,2,3"> <input type="submit" value="edit group users"> </form>
A simple example of editing a group's users using a select array of userid's.
<form action="/xml/httppost.xml" method="post">
<input type="hidden" name="_action" value="_group_edit_users">
<input type="hidden" name="groupid" value="99">
<select name="users[]" multiple>
<option value="1" selected>user 1</option>
<option value="2">user 2</option>
<option value="3">user 3</option>
</select>
<input type="submit" value="edit group users">
</form>
Adding a group with users (_group_add, _group_edit_users)
- Permissions required: groups.write.* (defined)
A more complex example of adding a new group and simultaneously assigning the group to an array of users using multiple actions. The group submitting the form will need write permissions for each field or the relative value will be ignored.
<form action="/xml/httppost.xml" method="post">
<input type="hidden" name="_action[]" value="_group_add">
<input type="hidden" name="_action[]" value="_group_edit_users">
groupname: <input type="text" name="groupname">
password: <input type="password" name="password">
<select name="users[]" multiple>
<option value="1" selected>user 1</option>
<option value="2">user 2</option>
<option value="3">user 3</option>
</select>
datetime_expire: <input type="text" name="datetime_expire">
groupalias: <input type="text" name="groupalias">
ftpchroot: <input type="text" name="ftpchroot">
httproot: <input type="text" name="httproot">
grouppermissions: <textarea name="grouppermissions"></textarea>
<input type="submit" value="add group">
</form>
