fix for can_manage()
This commit is contained in:
parent
1129cbce33
commit
4413d34f29
|
@ -1,11 +1,10 @@
|
||||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html><head><title>Module HowTo - Basic concepts</title>
|
||||||
<head>
|
|
||||||
<title>Module HowTo - Basic concepts</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="style/layout.css">
|
<link rel="stylesheet" type="text/css" href="style/layout.css">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
|
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"></head><body>
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<h1>Module HowTo - Basic concepts<br>
|
<h1>Module HowTo - Basic concepts<br>
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -23,8 +22,7 @@ LAM is distributed with a copy of the GPL license.<br>
|
||||||
Module names are usually named after the object class they manage.
|
Module names are usually named after the object class they manage.
|
||||||
However, you can use any name you want, it should be short and
|
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
|
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 <span
|
configuration dialog, on all other pages LAM will show a provided <span style="font-style: italic;">alias</span> name.<br>
|
||||||
style="font-style: italic;">alias</span> name.<br>
|
|
||||||
All account modules are stored in <span style="font-weight: bold;">lib/modules</span>.
|
All account modules are stored in <span style="font-weight: bold;">lib/modules</span>.
|
||||||
The filename must end with <span style="font-weight: bold;">.inc</span>
|
The filename must end with <span style="font-weight: bold;">.inc</span>
|
||||||
and the file must have the same name as its inside class.<br>
|
and the file must have the same name as its inside class.<br>
|
||||||
|
@ -32,9 +30,7 @@ and the file must have the same name as its inside class.<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span>
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span>
|
||||||
Our example module will provide the <span style="font-weight: bold;">class
|
Our example module will provide the <span style="font-weight: bold;">class
|
||||||
ieee802Devic</span><span style="font-style: italic; font-weight: bold;">e</span>,
|
ieee802Devic</span><span style="font-style: italic; font-weight: bold;">e</span>,
|
||||||
therefore the file will be called <span style="font-weight: bold;">lib/modules/ieee802Devic</span><span
|
therefore the file will be called <span style="font-weight: bold;">lib/modules/ieee802Devic</span><span style="font-style: italic; font-weight: bold;">e.inc</span>.<span style="font-style: italic;"></span><br>
|
||||||
style="font-style: italic; font-weight: bold;">e.inc</span>.<span
|
|
||||||
style="font-style: italic;"></span><br>
|
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<h2>3. Defining the class</h2>
|
<h2>3. Defining the class</h2>
|
||||||
|
@ -44,8 +40,7 @@ for all required class functions.<br>
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold;">Example:</span><br>
|
<span style="font-weight: bold;">Example:</span><br>
|
||||||
<br>
|
<br>
|
||||||
<table style="width: 100%; text-align: left;" class="mod-code"
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
||||||
border="0" cellpadding="2" cellspacing="2">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;">/**<br>
|
<td style="vertical-align: top;">/**<br>
|
||||||
|
@ -54,8 +49,7 @@ for all required class functions.<br>
|
||||||
* @package modules<br>
|
* @package modules<br>
|
||||||
*/<span style="font-weight: bold;"><br>
|
*/<span style="font-weight: bold;"><br>
|
||||||
class</span> <span style="color: rgb(255, 0, 0);">ieee802Device</span>
|
class</span> <span style="color: rgb(255, 0, 0);">ieee802Device</span>
|
||||||
<span style="font-style: italic;">extends </span><span
|
<span style="font-style: italic;">extends </span><span style="font-weight: bold;">baseModule</span> {<br>
|
||||||
style="font-weight: bold;">baseModule</span> {<br>
|
|
||||||
<br>
|
<br>
|
||||||
}<br>
|
}<br>
|
||||||
</td>
|
</td>
|
||||||
|
@ -72,14 +66,11 @@ will do the rest.<br>
|
||||||
Providing <span style="font-weight: bold;">meta data</span> is
|
Providing <span style="font-weight: bold;">meta data</span> is
|
||||||
optional, you can implement the required functions in your class, too.<br>
|
optional, you can implement the required functions in your class, too.<br>
|
||||||
<br>
|
<br>
|
||||||
The <span style="font-weight: bold;">baseModule</span> reads the <span
|
The <span style="font-weight: bold;">baseModule</span> reads the <span style="font-weight: bold;">meta data</span> by calling <span style="font-weight: bold;">get_metaData()</span> in your class.<br>
|
||||||
style="font-weight: bold;">meta data</span> by calling <span
|
|
||||||
style="font-weight: bold;">get_metaData()</span> in your class.<br>
|
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br>
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br>
|
||||||
<br>
|
<br>
|
||||||
<table style="width: 100%; text-align: left;" class="mod-code"
|
<table style="width: 100%; text-align: left;" class="mod-code" border="0" cellpadding="2" cellspacing="2">
|
||||||
border="0" cellpadding="2" cellspacing="2">
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;"> /**<br>
|
<td style="vertical-align: top;"> /**<br>
|
||||||
|
@ -88,12 +79,10 @@ class<br>
|
||||||
*<br>
|
*<br>
|
||||||
* @return array array with meta data<br>
|
* @return array array with meta data<br>
|
||||||
*/<br>
|
*/<br>
|
||||||
<span style="font-weight: bold;">function</span> <span
|
<span style="font-weight: bold;">function</span> <span style="color: rgb(255, 0, 0);">get_metaData</span>() {<br>
|
||||||
style="color: rgb(255, 0, 0);">get_metaData</span>() {<br>
|
|
||||||
$return = array();<br>
|
$return = array();<br>
|
||||||
// manages host accounts<br>
|
// icon<br>
|
||||||
$return["account_types"] =
|
$return['icon'] = 'user.png';<br>
|
||||||
array("host");<br>
|
|
||||||
}<br>
|
}<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -106,5 +95,4 @@ HowTo.<br>
|
||||||
<h2><span style="font-weight: bold;"></span></h2>
|
<h2><span style="font-weight: bold;"></span></h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body></html>
|
||||||
</html>
|
|
|
@ -3,8 +3,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="style/layout.css"></head><body>
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico">
|
<link rel="stylesheet" type="text/css" href="style/layout.css"><link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"></head><body>
|
||||||
|
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<h1>Module HowTo - General module options<br>
|
<h1>Module HowTo - General module options<br>
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -13,11 +14,10 @@
|
||||||
<div style="text-align: left;"><br>
|
<div style="text-align: left;"><br>
|
||||||
<h2>1. Account types<br>
|
<h2>1. Account types<br>
|
||||||
</h2>
|
</h2>
|
||||||
LAM currently provides three account types: <span style="font-weight: bold;">users, groups, hosts<br>
|
LAM provides multiple account types (e.g. users, groups, hosts).<span style="font-weight: bold;"><br>
|
||||||
</span>A module can manage one or more account types.<br>
|
</span>A module can manage one or more account types.<br>
|
||||||
<br>
|
<br>
|
||||||
The types are specified with <span style="font-weight: bold;">can_manage()</span>
|
The types are specified with <span style="font-weight: bold;">can_manage()</span>.<br>
|
||||||
or <span style="font-weight: bold;">meta['account_types']</span>.<br>
|
|
||||||
<br>
|
<br>
|
||||||
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
<span style="font-weight: bold; text-decoration: underline;">Example:</span><br style="font-weight: bold; text-decoration: underline;">
|
||||||
<br>
|
<br>
|
||||||
|
@ -28,18 +28,12 @@ module will be used only for host accounts.<br>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;"> /**<br>
|
<td style="vertical-align: top;"> /**<br>
|
||||||
* Returns meta data that is interpreted by parent
|
* Returns true if this module can manage accounts of the current type, otherwise false.<br>
|
||||||
class<br>
|
|
||||||
* <br>
|
* <br>
|
||||||
* @return array array with meta data<br>
|
* @return boolean true if module fits<br>
|
||||||
*/<br>
|
*/<br>
|
||||||
<span style="font-weight: bold;">function</span>
|
public function <span style="color: red;">can_manage()</span> {<br>
|
||||||
get_metaData() {<br>
|
return $this->get_scope() == 'host';<br>
|
||||||
$return = array();<br>
|
|
||||||
// manages host accounts<br>
|
|
||||||
<span style="color: rgb(255, 0, 0);">
|
|
||||||
$return["account_types"] = array("host");</span><br style="color: rgb(255, 0, 0);">
|
|
||||||
return $return;<br>
|
|
||||||
}<br>
|
}<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue