[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/key_handler.c

This handler keeps track of the keys. The keys are arranged in groups and each key type in the group has a name and a set of permissions associated with it.

Written by Deutha

Inherits

This class inherits the following classes /std/object.c

Method index

Public Functions

These are functions that everyone can access.

add_key_permission
int add_key_permission(string group,
                       string key,
                       string type)

This method adds in a specific permission type into the current permission set for this key.

Parameters:
group - the key group to add the permision to
key - the key to add the permission for
type - the permission type to add in

Returns:
0 if it is already added, 1 if not

See also:
remove_key_permission(), query_key_permission(), set_key_permissions(), query_all_key_permissions() and query_all_keys()


delete_key_name
void delete_key_name(string group,
                     string key)

This method removes a specified key name from the current key name mapping.

Parameters:
group - the group to remove the key from
key - the key type to remove the name of

See also:
set_key_name(), query_key_name() and query_all_key_names()


query_all_key_names
mapping query_all_key_names(string group)

This method returns all the key names for the given key group. The index of the mapping is the key type and the value is its name.

Parameters:
group - the key group

Returns:
the mapping containing the key names

See also:
delete_key_name(), set_key_name() and query_key_name()


query_all_key_permissions
string * query_all_key_permissions(string group,
                                   string key)

This method returns all the permision types associated with the key. The permission types are an array of string permision type names. If the key name is non-existant an empty array will be returned.

Parameters:
group - the key group to lookup
key - the key name to lookup

Returns:
the array of permission types

See also:
remove_key_permission(), add_key_permission(), query_key_permission(), set_key_permissions() and query_all_keys()


query_all_keys
mapping query_all_keys(string group)

This method returns all the keys in the current group. The mapping consists has an index of the key name and a value of an array of key permission types.

Parameters:
group - the key group to get permissions for

Returns:
a mapping containing all the permissions

See also:
remove_key_permission(), add_key_permission(), query_key_permission(), set_key_permissions() and query_all_key_permissions()


query_key_name
string query_key_name(string group,
                      string key)

This method returns the key name for a given key.

Parameters:
group - the key group to lookup
key - the key type to look up

Returns:
the key's name

See also:
delete_key_name(), set_key_name() and query_all_key_names()


query_key_permission
int query_key_permission(string group,
                         string key,
                         string type)

This method will see if the given key perrmision exists for this key in this particular group and key.

Parameters:
group - the key group to look up in
key - the key to check
type - the permission type to see if it exists

Returns:
1 if the permission exists, 0 if not

See also:
remove_key_permission(), add_key_permission(), set_key_permissions(), query_all_key_permissions() and query_all_keys()


remove_key_permission
int remove_key_permission(string group,
                          string key,
                          string type)

This method removes a specific permission type from the given key group and key.

Parameters:
group - the key group to remove the key from
key - the key to remove the permission from
type - the type of permission to remove

Returns:
0 if the permission was not remove, 1 if it was

See also:
add_key_permission(), query_key_permission(), set_key_permissions(), query_all_key_permissions() and query_all_keys()


set_key_name
void set_key_name(string group,
                  string key,
                  string name)

This method sets the name of the specified key.

Parameters:
group - the group to set the name of the key in
key - the type of key to set the name for
name - the name of the key to set

See also:
delete_key_name(), query_key_name() and query_all_key_names()


set_key_permissions
void set_key_permissions(string group,
                         string key,
                         string * types)

This method will set the key permissions for a certain sort of key. It will overwrite any current possible key permission sets.

Parameters:
group - the key group to set the permissions for
key - the key to set the permission for
types - the new set of permission types

See also:
remove_key_permission(), add_key_permission(), query_key_permission(), query_all_key_permissions() and query_all_keys()