From 4413d34f2946070a441172fb303b7b85cf899048 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 12 Jul 2014 14:12:19 +0000 Subject: [PATCH] fix for can_manage() --- lam/docs/devel/mod_basics.htm | 42 ++++++++++++---------------------- lam/docs/devel/mod_general.htm | 26 ++++++++------------- 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/lam/docs/devel/mod_basics.htm b/lam/docs/devel/mod_basics.htm index 96e1c838..4ded5f0b 100644 --- a/lam/docs/devel/mod_basics.htm +++ b/lam/docs/devel/mod_basics.htm @@ -1,11 +1,10 @@ - - - Module HowTo - Basic concepts +Module HowTo - Basic concepts + + + - - - +

Module HowTo - Basic concepts

@@ -23,8 +22,7 @@ LAM is distributed with a copy of the GPL license.
Module names are usually named after the object class they manage. However, you can use any name you want, it should be short and containing only a-z and 0-9. The module name is only shown in the -configuration dialog, on all other pages LAM will show a provided alias name.
+configuration dialog, on all other pages LAM will show a provided alias name.
All account modules are stored in lib/modules. The filename must end with .inc and the file must have the same name as its inside class.
@@ -32,9 +30,7 @@ and the file must have the same name as its inside class.
Example: Our example module will provide the class ieee802Device, -therefore the file will be called lib/modules/ieee802Device.inc.
+therefore the file will be called lib/modules/ieee802Device.inc.


3. Defining the class

@@ -44,8 +40,7 @@ for all required class functions.

Example:

- +
@@ -72,14 +66,11 @@ will do the rest.
Providing meta data is optional, you can implement the required functions in your class, too.

-The baseModule reads the meta data by calling get_metaData() in your class.
+The baseModule reads the meta data by calling get_metaData() in your class.

Example:

-
/**
@@ -54,8 +49,7 @@ for all required class functions.
* @package modules
*/
class
ieee802Device - extends baseModule {
+ extends baseModule {

}
+
@@ -106,5 +95,4 @@ HowTo.

- - + \ No newline at end of file diff --git a/lam/docs/devel/mod_general.htm b/lam/docs/devel/mod_general.htm index aa19ec2b..d2b57563 100644 --- a/lam/docs/devel/mod_general.htm +++ b/lam/docs/devel/mod_general.htm @@ -2,9 +2,10 @@ Module HowTo - General module options + - - + +

Module HowTo - General module options

@@ -13,11 +14,10 @@

1. Account types

-LAM currently provides three account types: users, groups, hosts
+LAM provides multiple account types (e.g. users, groups, hosts).
A module can manage one or more account types.

-The types are specified with can_manage() -or meta['account_types'].
+The types are specified with can_manage().

Example:

@@ -28,18 +28,12 @@ module will be used only for host accounts.
    /**
@@ -88,12 +79,10 @@ class
    *
    * @return array array with meta data
    */
-    function get_metaData() {
+    function get_metaData() {
        $return = array();
-        // manages host accounts
-        $return["account_types"] = -array("host");
+        // icon
+        $return['icon'] = 'user.png';
    }
    /**
-    * Returns meta data that is interpreted by parent -class
-    *
-    * @return array array with meta data
+    * Returns true if this module can manage accounts of the current type, otherwise false.
+    *
+    * @return boolean true if module fits
    */
-    function -get_metaData() {
-        $return = array();
-        // manages host accounts
-     -    $return["account_types"] = array("host");
-        return $return;
+    public function can_manage() {
+        return $this->get_scope() == 'host';
    }