mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-28 14:44:17 +01:00
Compare commits
1 Commits
feature/79
...
2.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7f9f1b93e |
@@ -1,99 +0,0 @@
|
|||||||
# Phpdoc dokuwiki template
|
|
||||||
This directory contains a template for rendering iTop phpdoc as dokuwiki pages.
|
|
||||||
|
|
||||||
|
|
||||||
Conventional tags that you should use:
|
|
||||||
* `@internal` : exclude from the documentation.
|
|
||||||
* `@api` : it means that a method is an api, thus it may be interacted with.
|
|
||||||
* `@see` : it points to another documented method
|
|
||||||
* `@link` : external url
|
|
||||||
* if you point to another page of the wiki, please use relative links.
|
|
||||||
* `@example` : let you provide example of code
|
|
||||||
* `@param`, `@return`, `@throws`, ...
|
|
||||||
|
|
||||||
|
|
||||||
## Special instructions
|
|
||||||
|
|
||||||
Some iTop specific tags were added :
|
|
||||||
* `@api-advanced`: it means that a method is an `@api` but mark it also as "complex" to use
|
|
||||||
* `@overwritable-hook`: used to mark a method as "designed to be extended"
|
|
||||||
* `@extension-hook`: not used for now
|
|
||||||
* `@phpdoc-tuning-exclude-inherited`: once this tag is present on a class, it's inherited methods won't be showed.
|
|
||||||
|
|
||||||
|
|
||||||
### known limitations:
|
|
||||||
#### `@see` tags must be very specific:
|
|
||||||
* always prefix class members (attributes or methods) with `ClassName::` (do not use self)
|
|
||||||
* for methods always suffix them with `()`,
|
|
||||||
* do not reference variables since they are not documented. If you have to, always prefix them with `$`
|
|
||||||
|
|
||||||
examples:
|
|
||||||
```
|
|
||||||
/**
|
|
||||||
* @see DBObject
|
|
||||||
* @see DBObject::Get()
|
|
||||||
* @see DBObject::$foo
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Do not use inline tags, they do not work properly, example:
|
|
||||||
```
|
|
||||||
/**
|
|
||||||
* This is a texts with an inline tag {@see [FQSEN] [<description>]} it must never be used
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### The `@example` tag must respect this very precise syntax
|
|
||||||
* the sentence in the first line (next to the tag) is the title, it must be enclosed by double quotes
|
|
||||||
* the following lines are the sample code.
|
|
||||||
* 💔 since we simply hack the official tag, this syntax must be respected carefully 💔
|
|
||||||
example:
|
|
||||||
```
|
|
||||||
/**
|
|
||||||
* @example "This is the title of the multiline example"
|
|
||||||
* $foo = DBObject::Get('foo');
|
|
||||||
* DBObject::Set('foo', ++$foo);
|
|
||||||
*/
|
|
||||||
```
|
|
||||||
|
|
||||||
## How content is included into the documentation
|
|
||||||
|
|
||||||
**For a class** those requirements have to be respected:
|
|
||||||
- the file containing the class must be listed in `/phpdoc/files/file[]` of `.doc/phpdoc-objects-manipulation.dist.xml`
|
|
||||||
- the class **must not** have the tag `@internal`
|
|
||||||
- the class **must** have at least one of: `@api`, `@api-advanced`, `@overwritable-hook`, `@extension-hook`
|
|
||||||
|
|
||||||
Then, **for a method** of an eligible class:
|
|
||||||
- **public** methods **must** have at least one of: `@api`, `@api-advanced`, `@overwritable-hook`, `@extension-hook`
|
|
||||||
- **protected** methods **must** have at least one of: `@overwritable-hook`, `@extension-hook`
|
|
||||||
- **private** methods are **always excluded**
|
|
||||||
|
|
||||||
**Class properties** and **constants** are never documented (this is subject to change).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## A note about the rendering engine
|
|
||||||
|
|
||||||
:notebook: as spaces are used to mark code, the templates (`.doc/phpdoc-templates/combodo-wiki/*`) have very few indentation, thus they are awful to read (sorry).
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
```
|
|
||||||
cd .doc
|
|
||||||
composer require phpdocumentor/phpdocumentor:~2 --dev
|
|
||||||
```
|
|
||||||
|
|
||||||
## Generation
|
|
||||||
|
|
||||||
1. Switch to this directory : `cd /path/to/itop/.doc`
|
|
||||||
2. `composer install`
|
|
||||||
3. `./bin/build-doc-object-manipulation`
|
|
||||||
3. `./bin/build-doc-extensions`
|
|
||||||
4. Get the generated files from `/path/to/itop/data/phpdocumentor/output`
|
|
||||||
|
|
||||||
## Dokuwiki requirements
|
|
||||||
* the template uses the [wrap plugin](https://www.dokuwiki.org/plugin:wrap).
|
|
||||||
* the generated files have to be placed under an arbitrary directory of `[/path/to/dokuwiki]/data/pages`.
|
|
||||||
* the html has to be activated [config:htmlok](https://www.dokuwiki.org/config:htmlok)
|
|
||||||
* the generated files have to be in lowercase
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/sh -x
|
|
||||||
|
|
||||||
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf data/phpdocumentor/output/extensions/ && rm -rf data/phpdocumentor/temp/extensions/ && ./vendor/bin/phpdoc -c ./phpdoc-extensions.dist.xml -vvv
|
|
||||||
|
|
||||||
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
|
|
||||||
cd ../data/phpdocumentor/output/extensions/ && for i in $(ls | grep [A-Z]); do mv -i $i $(echo $i | tr 'A-Z' 'a-z'); done
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh -x
|
|
||||||
|
|
||||||
rm -rf /tmp/phpdoc-twig-cache/ && rm -rf ../data/phpdocumentor/output/objects-manipulation/ && rm -rf ../data/phpdocumentor/temp/objects-manipulation/ && ./vendor/bin/phpdoc -c ./phpdoc-objects-manipulation.dist.xml -vvv
|
|
||||||
|
|
||||||
|
|
||||||
# now wee need to lowercase every generated file because dokuwiki can't handle uppercase
|
|
||||||
cd ../data/phpdocumentor/output/objects-manipulation/ && for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"require-dev": {
|
|
||||||
"phpdocumentor/phpdocumentor": "~2",
|
|
||||||
"jms/serializer": "1.7.*"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
3015
.doc/composer.lock
generated
3015
.doc/composer.lock
generated
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 983 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 MiB |
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 MiB |
@@ -1,98 +0,0 @@
|
|||||||
# iTop version history
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'themeVariables': {
|
|
||||||
'git0': 'lawngreen',
|
|
||||||
'git3': 'dodgerblue',
|
|
||||||
'git4': 'grey',
|
|
||||||
'git5': 'grey',
|
|
||||||
'git6': 'grey',
|
|
||||||
'git7': 'grey'
|
|
||||||
}, 'gitGraph': {'showBranches': true,'mainBranchName': 'develop','rotateCommitLabel': true}} }%%
|
|
||||||
gitGraph
|
|
||||||
commit id: "2016-07-06" tag: "2.3.0" type: HIGHLIGHT
|
|
||||||
branch support/2.3 order: 900
|
|
||||||
commit id: "2016-07-08" tag: "2.3.1"
|
|
||||||
commit id: "2016-12-22" tag: "2.3.3"
|
|
||||||
commit id: "2017-04-14" tag: "2.3.4"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2017-07-12" tag: "2.4.0-beta" type: REVERSE
|
|
||||||
commit id: "2017-11-16" tag: "2.4.0" type: HIGHLIGHT
|
|
||||||
branch support/2.4 order: 890
|
|
||||||
commit id: "2018-02-14" tag: "2.4.1"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2018-04-25" tag: "2.5.0-beta" type: REVERSE
|
|
||||||
checkout support/2.4
|
|
||||||
commit id: "2018-06-14" tag: "2.4.2"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2018-06-27" tag: "2.5.0" type: HIGHLIGHT
|
|
||||||
branch support/2.5 order: 880
|
|
||||||
checkout develop
|
|
||||||
commit id: "2019-01-09" tag: "2.6.0" type: HIGHLIGHT
|
|
||||||
branch support/2.6 order: 870
|
|
||||||
commit id: "2019-03-28" tag: "2.6.1"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2019-12-18" tag: "2.7.0-beta" type: REVERSE
|
|
||||||
checkout support/2.5
|
|
||||||
commit id: "2020-01-22" tag: "2.5.4"
|
|
||||||
checkout support/2.6
|
|
||||||
commit id: "2020-01-23" tag: "2.6.3"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2020-01-29" tag: "2.7.0-beta2" type: REVERSE
|
|
||||||
commit id: "2020-04-01" tag: "2.7.0-1" type: HIGHLIGHT
|
|
||||||
checkout support/2.6
|
|
||||||
commit id: "2020-04-22" tag: "2.6.4"
|
|
||||||
checkout develop
|
|
||||||
branch support/2.7 order: 860
|
|
||||||
commit id: "2020-06-26" tag: "2.7.1"
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2020-12-09" tag: "2.7.3"
|
|
||||||
commit id: "2021-03-31" tag: "2.7.4"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2021-04-06" tag: "3.0.0-beta" type: REVERSE
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2021-07-05" tag: "2.7.5"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2021-07-05." tag: "3.0.0-beta2" type: REVERSE
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2021-12-17" tag: "2.7.6"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2022-01-04" tag: "3.0.0" type: HIGHLIGHT
|
|
||||||
branch support/3.0 order: 850
|
|
||||||
commit id: "2022-04-08" tag: "3.0.1"
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2022-07-11" tag: "2.7.7"
|
|
||||||
checkout support/3.0
|
|
||||||
commit id: "2022-09-12" tag: "3.0.2-1"
|
|
||||||
checkout develop
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2022-12-28" tag: "2.7.8"
|
|
||||||
checkout support/3.0
|
|
||||||
commit id: "2023-04-12" tag: "3.0.3"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2023-06-19" tag: "3.1.0-beta" type: REVERSE
|
|
||||||
commit id: "2023-07-26" tag: "3.1.0-1" type: HIGHLIGHT
|
|
||||||
branch support/3.1 order: 840
|
|
||||||
checkout support/3.1
|
|
||||||
commit id: "2023-08-09" tag: "3.1.0-2"
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2023-08-10" tag: "2.7.9"
|
|
||||||
checkout support/3.1
|
|
||||||
commit id: "2023-12-20" tag: "3.1.1"
|
|
||||||
checkout develop
|
|
||||||
commit id: "2024-01-15" tag: "Start 3.2" type: HIGHLIGHT
|
|
||||||
branch support/3.2 order: 830
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2024-01-17a" tag: "2.7.10"
|
|
||||||
checkout support/3.0
|
|
||||||
commit id: "2024-01-17b" tag: "3.0.4"
|
|
||||||
checkout support/2.7
|
|
||||||
commit id: "2024-09-28" tag: "2.7.11"
|
|
||||||
checkout support/3.1
|
|
||||||
commit id: "2024-09-27" tag: "3.1.2"
|
|
||||||
checkout support/3.2
|
|
||||||
commit id: "2024-06-25" tag: "3.2.0-beta1" type: REVERSE
|
|
||||||
commit id: "2024-08-07" tag: "3.2.0"
|
|
||||||
```
|
|
||||||
|
|
||||||
To learn more, check the [iTop community versions history on the official wiki](https://www.itophub.io/wiki/page?id=latest:release:start).
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<phpdoc>
|
|
||||||
<title><![CDATA[iTop extensions]]></title>
|
|
||||||
|
|
||||||
<parser>
|
|
||||||
<target>../data/phpdocumentor/temp/extensions</target>
|
|
||||||
</parser>
|
|
||||||
|
|
||||||
<transformer>
|
|
||||||
<target>../data/phpdocumentor/output/extensions</target>
|
|
||||||
</transformer>
|
|
||||||
|
|
||||||
<transformations>
|
|
||||||
<template name="phpdoc-templates/combodo-wiki"/>
|
|
||||||
</transformations>
|
|
||||||
|
|
||||||
<files>
|
|
||||||
<file>../application/applicationextension.inc.php</file>
|
|
||||||
</files>
|
|
||||||
</phpdoc>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<phpdoc>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
/**
|
|
||||||
The documentation of this file can be found here : https://docs.phpdoc.org/references/configuration.html
|
|
||||||
it has to be completed by the CLI parameters documentation which is more comprehensive: https://docs.phpdoc.org/references/commands/project_run.html#usage
|
|
||||||
|
|
||||||
usage:
|
|
||||||
vendor/bin/phpdoc -c phpdoc-objects-manipulation.dist.xml
|
|
||||||
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
|
|
||||||
<title><![CDATA[iTop's objects manipulation API]]></title>
|
|
||||||
|
|
||||||
<parser>
|
|
||||||
<default-package-name>iTopORM</default-package-name>
|
|
||||||
<target>../data/phpdocumentor/temp/objects-manipulation</target>
|
|
||||||
<visibility>public,protected</visibility>
|
|
||||||
<markers>
|
|
||||||
<!--<item>TODO</item>-->
|
|
||||||
<!--<item>FIXME</item>-->
|
|
||||||
</markers>
|
|
||||||
<extensions>
|
|
||||||
<extension>php</extension>
|
|
||||||
</extensions>
|
|
||||||
</parser>
|
|
||||||
|
|
||||||
<transformer>
|
|
||||||
<target>../data/phpdocumentor/output/objects-manipulation</target>
|
|
||||||
</transformer>
|
|
||||||
|
|
||||||
<transformations>
|
|
||||||
<template name="phpdoc-templates/combodo-wiki"/>
|
|
||||||
</transformations>
|
|
||||||
|
|
||||||
<!--<logging>-->
|
|
||||||
<!--<level>warn</level>-->
|
|
||||||
<!--<paths>-->
|
|
||||||
<!--<!–<default>data/phpdocumentor/log/objects-manipulation/{DATE}.log</default>–>-->
|
|
||||||
<!--<!–<errors>data/phpdocumentor/log/objects-manipulation/{DATE}.errors.log</errors>–>-->
|
|
||||||
|
|
||||||
<!--<default>{APP_ROOT}/data/log/{DATE}.log</default>-->
|
|
||||||
<!--<errors>{APP_ROOT}/data/log/{DATE}.errors.log</errors>-->
|
|
||||||
<!--</paths>-->
|
|
||||||
<!--</logging>-->
|
|
||||||
|
|
||||||
<files>
|
|
||||||
<file>../core/dbobject.class.php</file>
|
|
||||||
<file>../core/dbobjectsearch.class.php</file>
|
|
||||||
<file>../core/metamodel.class.php</file>
|
|
||||||
<file>../core/dbobjectset.class.php</file>
|
|
||||||
<file>../core/dbsearch.class.php</file>
|
|
||||||
<file>../core/dbunionsearch.class.php</file>
|
|
||||||
</files>
|
|
||||||
|
|
||||||
</phpdoc>
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
|
|
||||||
{% if node.tags['internal'] is defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This class is "internal", and thus is not documented!</WRAP>
|
|
||||||
{% elseif node.tags['api'] is not defined and node.tags['api-advanced'] is not defined and node.tags['overwritable-hook'] is not defined and node.tags['extension-hook'] is not defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This class is neither "api", "api-advanced", "overwritable-hook" or "extension-hook", and thus is not documented!</WRAP>
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
|
|
||||||
{% if node.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
|
||||||
{% if node.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
|
||||||
{% if node.final %}<wrap notice>final</wrap>{% endif %}
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:node, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if node.deprecated %}
|
|
||||||
=== **<del>Deprecated</del>**===
|
|
||||||
//{{ node.tags.deprecated[0].description }}//
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
== {{ node.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ node.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '====='} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% set class = node.parent %}
|
|
||||||
{% block hierarchy_element %}
|
|
||||||
|
|
||||||
{% if class and class.name is defined and class.name|trim != '' %}
|
|
||||||
==== parent ====
|
|
||||||
{% set child = class %}
|
|
||||||
{% set class = class.parent %}
|
|
||||||
{{ block('hierarchy_element') }}
|
|
||||||
[[{{ child.name }}|{{ child.name }}]]
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for interface in node.interfaces|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Implements ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ interface.fullyQualifiedStructuralElementName ?: interface }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for trait in node.usedTraits|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Uses traits ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ trait.fullyQualifiedStructuralElementName ?: trait }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:node, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:node, title_level: '=====', blacklist: ['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'phpdoc-tuning-exclude-inherited', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'copyright', 'license', 'code-example']} %}
|
|
||||||
|
|
||||||
{% set methods = node.inheritedMethods.merge(node.methods.merge(node.magicMethods)) %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api-advanced'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'overwritable-hook'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'extension-hook'} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '=====', sub_title_level: '=='} %}
|
|
||||||
|
|
||||||
<WRAP clear />
|
|
||||||
|
|
||||||
{% for method in methods|sort_asc
|
|
||||||
if method.visibility == 'public'
|
|
||||||
and (
|
|
||||||
method.tags['api'] is defined
|
|
||||||
or method.tags['api-advanced'] is defined
|
|
||||||
or method.tags['overwritable-hook'] is defined
|
|
||||||
or method.tags['extension-hook'] is defined
|
|
||||||
)
|
|
||||||
and (
|
|
||||||
node.tags['phpdoc-tuning-exclude-inherited'] is not defined
|
|
||||||
or method.parent.name == node.name
|
|
||||||
)
|
|
||||||
%}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Public methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% for method in methods|sort_asc if method.visibility == 'protected' and (method.tags['overwritable-hook'] is defined or method.tags['extension-hook'] is defined) %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Protected methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% set constants = node.inheritedConstants.merge(node.constants) %}
|
|
||||||
{% if constants|length > 0 %}
|
|
||||||
===== Constants =====
|
|
||||||
{% for constant in constants|sort_asc %}
|
|
||||||
{{ block('constant') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{#{% set properties = node.inheritedProperties.merge(node.properties.merge(node.magicProperties)) %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'public' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Public properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'protected' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Protected properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{%- endif %} {#{% elseif node.tags['xxx'] is not defined and ... #}
|
|
||||||
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
{% block constant %}
|
|
||||||
|
|
||||||
<WRAP group box >
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== {{ constant.name }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column>
|
|
||||||
{% if constant.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
|
||||||
{% if (node.parent is not null and constant.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
== {{ constant.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ constant.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
{% if constant.deprecated %}
|
|
||||||
=== Deprecated ===
|
|
||||||
{{ constant.tags.deprecated[0].description|raw }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include 'includes/inherited-from.txt.twig' with {structure:constant} %}
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:constant, title_level: '=='} %}
|
|
||||||
|
|
||||||
{% include 'includes/uses.txt.twig' with {structure:constant, title_level: '=='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:constant, title_level: '==', blacklist: ['link', 'see', 'var', 'deprecated', 'uses', 'package', 'subpackage', 'todo', 'code-example']} %}
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
{% block method %}
|
|
||||||
|
|
||||||
|
|
||||||
<WRAP group box >
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== {{ method.name }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
<WRAP third column >
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:method, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
{% if method.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
|
||||||
{% if (node.parent is not null and method.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
{% if method.abstract %}<wrap warning>abstract</wrap> {% endif %}
|
|
||||||
{% if method.final %}<wrap notice>final</wrap> {% endif %}
|
|
||||||
<wrap notice>{{ method.visibility }}</wrap>
|
|
||||||
{% if method.static %}<wrap warning>static</wrap> {% endif %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
== {{ method.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ method.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
<code php>{% if method.abstract %}abstract {% endif %}{% if method.final %}final {% endif %}{{ method.visibility }} {% if method.static %}static {% endif %}{{ method.name }}({% for argument in method.arguments %}{{ argument.isVariadic ? '...' }}{{ argument.name }}{{ argument.default ? (' = '~argument.default)|raw }}{% if not loop.last %}, {% endif %}{% endfor %})</code>
|
|
||||||
|
|
||||||
<WRAP twothirds column >
|
|
||||||
|
|
||||||
|
|
||||||
=== Parameters ===
|
|
||||||
{% if method.arguments|length > 0 -%}
|
|
||||||
^ types ^ name ^ default ^ description ^
|
|
||||||
{% for argument in method.arguments -%}
|
|
||||||
| **<nowiki>{{ argument.types|join('|')|raw }}</nowiki>** | {{ argument.name }} {{ argument.isVariadic ? '<small style="color: gray">variadic</small>' }} | <nowiki>{{ argument.default|raw }}</nowiki> | {{ argument.description|trim|replace("\n", ' ')|raw }} |{{ "\r\n" }}
|
|
||||||
{%- endfor %}
|
|
||||||
{% else %}
|
|
||||||
//none//
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{#=== Parameters ===#}
|
|
||||||
{#{% if method.arguments|length > 0 -%}#}
|
|
||||||
{#{% for argument in method.arguments -%}#}
|
|
||||||
{#== {{ argument.name }} ==#}
|
|
||||||
|
|
||||||
|
|
||||||
{#{% set varDesc %}#}
|
|
||||||
{#<span style="margin:0 10px; 0 20px; font-weight: bold;">{{ argument.types|join('|') }}</span>#}
|
|
||||||
{#{{ argument.isVariadic ? '<small style="color: gray">variadic</small>' }}#}
|
|
||||||
{#{{ argument.description|raw }}#}
|
|
||||||
{#{% endset %}#}
|
|
||||||
{#<html>{{ varDesc|markdown|raw }}</html>#}
|
|
||||||
{#{%- endfor %}#}
|
|
||||||
{#{% else %}#}
|
|
||||||
{#<wrap tip>This method has no parameter</wrap>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{% if method.response and method.response.types|join() != 'void' %}
|
|
||||||
=== Returns ===
|
|
||||||
<html>{{ ('**' ~ method.response.types|join('|')|trim ~ '** ' ~ method.response.description)|markdown|raw }}</html>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column >
|
|
||||||
|
|
||||||
{% if method.tags.throws|length > 0 or method.tags.throw|length > 0 %}
|
|
||||||
=== Throws ===
|
|
||||||
{% for exception in method.tags.throws -%}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}''{{ exception.types|join('|')|raw }}'' <nowiki>{{ exception.description|raw }}</nowiki>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include 'includes/inherited-from.txt.twig' with {structure:method} %}
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/uses.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/used-by.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags-with-description.txt.twig' with {structure:method, title_level: '===', WRAP: 'info', tagsWithDescription: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:method, title_level: '===', blacklist: ['todo', 'link', 'see', 'abstract', 'example', 'param', 'return', 'access', 'deprecated', 'throws', 'throw', 'uses', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'used-by', 'inheritdoc', 'code-example']} %}
|
|
||||||
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:method, title_level: '==='} %}
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
{% block property %}
|
|
||||||
|
|
||||||
<WRAP group box>
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== ${{ property.name }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column>
|
|
||||||
{% if property.deprecated %}<wrap danger>deprecated</wrap> {% endif %}
|
|
||||||
{% if (node.parent is not null and property.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
== {{ property.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ property.description|markdown|raw }}</html>
|
|
||||||
{% if property.var.0.description %}<html>{{ property.var.0.description|markdown|raw }}</html>{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% if property.types %}#}
|
|
||||||
{#== Type ==#}
|
|
||||||
{#{% for type in property.types %}#}
|
|
||||||
{#{% if loop.length > 1 %} * {% endif %}{{ type|raw }} : {{ type.description|raw }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{{ property.types|join('|')|raw }}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{% if property.deprecated %}
|
|
||||||
== Deprecated ==
|
|
||||||
{{ property.tags.deprecated[0].description }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include 'includes/inherited-from.txt.twig' with {structure:property} %}
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:property, title_level: '=='} %}
|
|
||||||
|
|
||||||
{% include 'includes/uses.txt.twig' with {structure:property, title_level: ''} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:property, title_level: '==', blacklist: ['link', 'see', 'access', 'var', 'deprecated', 'uses', 'todo', 'code-example']} %}
|
|
||||||
|
|
||||||
|
|
||||||
<code php>{{ property.visibility }} ${{ property.name }}{% if property.types %} : {{ property.types|join('|')|raw }}{% endif %}</code>
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{{ node.source|raw }}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{#<section class="row-fluid">#}
|
|
||||||
{#<div class="span2 sidebar">#}
|
|
||||||
{#{% set namespace = project.namespace %}#}
|
|
||||||
{#{{ block('sidebarNamespaces') }}#}
|
|
||||||
{#</div>#}
|
|
||||||
{#</section>#}
|
|
||||||
{#<section class="row-fluid">#}
|
|
||||||
====== {{ node.path|split('/')|slice(0,-1)|join('/') }}{{ node.name }} ======
|
|
||||||
{{ node.summary }}
|
|
||||||
<html>{{ node.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
{% if node.traits|length > 0 %}
|
|
||||||
|
|
||||||
===== Traits =====
|
|
||||||
{% for trait in node.traits %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ trait|raw }}</td>
|
|
||||||
<td><em>{{ trait.summary }}</em></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{% if node.interfaces|length > 0 %}
|
|
||||||
===== Interfaces =====
|
|
||||||
{% for interface in node.interfaces %}
|
|
||||||
<tr>
|
|
||||||
<td>{{ interface|raw }}</td>
|
|
||||||
<td><em>{{ interface.summary }}</em></td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.classes|length > 0 %}
|
|
||||||
===== Classes =====
|
|
||||||
{% for class in node.classes %}
|
|
||||||
{{ class|raw }}
|
|
||||||
<em>{{ class.summary }}</em>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.package is not empty and node.package != '\\' %}
|
|
||||||
===== Package =====
|
|
||||||
{{ node.subpackage ? (node.package ~ '\\' ~ node.subpackage) : node.package }}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% for tagName,tags in node.tags if tagName in ['link', 'see'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
===== See also =====
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
<dd><a href="{{ tag.reference ?: tag.link }}"><div class="namespace-wrapper">{{ tag.description ?: tag.reference }}</div></a></dd>
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<h2>Tags</h2>
|
|
||||||
<table class="table table-condensed">
|
|
||||||
{% for tagName,tags in node.tags if tagName not in ['link', 'see', 'package', 'subpackage'] %}
|
|
||||||
<tr>
|
|
||||||
<th>
|
|
||||||
{{ tagName }}
|
|
||||||
</th>
|
|
||||||
<td>
|
|
||||||
{% for tag in tags %}
|
|
||||||
{{ tag.description|markdown|raw }}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr><td colspan="2"><em>None found</em></td></tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</aside>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if node.constants|length > 0 %}
|
|
||||||
<div class="row-fluid">
|
|
||||||
<section class="span8 content file">
|
|
||||||
<h2>Constants</h2>
|
|
||||||
</section>
|
|
||||||
<aside class="span4 detailsbar"></aside>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% for constant in node.constants %}
|
|
||||||
{{ block('constant') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.functions|length > 0 %}
|
|
||||||
<div class="row-fluid">
|
|
||||||
<section class="span8 content file">
|
|
||||||
<h2>Functions</h2>
|
|
||||||
</section>
|
|
||||||
<aside class="span4 detailsbar"></aside>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% for method in node.functions %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<div id="source-view" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="source-view-label" aria-hidden="true">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h3 id="source-view-label">{{ node.file.name }}</h3>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<pre data-src="{{ path('files/' ~ node.path ~ '.txt')|raw }}" class="language-php line-numbers"></pre>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
{% extends 'layout.html.twig' %}
|
|
||||||
|
|
||||||
{% block stylesheets %}
|
|
||||||
<link href="{{ path('css/jquery.iviewer.css') }}" rel="stylesheet" media="all"/>
|
|
||||||
<style>
|
|
||||||
#viewer {
|
|
||||||
position: relative;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.wrapper {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block javascripts %}
|
|
||||||
<script src="{{ path('js/jquery.mousewheel.js') }}" type="text/javascript"></script>
|
|
||||||
<script src="{{ path('js/jquery.iviewer.js') }}" type="text/javascript"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(window).resize(function(){
|
|
||||||
$("#viewer").height($(window).height() - 100);
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("#viewer").iviewer({src: '{{ path('graphs/classes.svg') }}', zoom_animation: false});
|
|
||||||
$('#viewer img').bind('dragstart', function(event){
|
|
||||||
event.preventDefault();
|
|
||||||
});
|
|
||||||
$(window).resize();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row-fluid">
|
|
||||||
<div class="span12">
|
|
||||||
<div class="wrapper">
|
|
||||||
<div id="viewer" class="viewer"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Fixes a vulnerability in CentOS: http://stackoverflow.com/questions/20533279/prevent-php-from-parsing-non-php-files-such-as-somefile-php-txt
|
|
||||||
<FilesMatch \.php\.txt$>
|
|
||||||
RemoveHandler .php
|
|
||||||
ForceType text/plain
|
|
||||||
</FilesMatch>
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{%- set title_level = '==' -%}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if sub_title_level is not defined %}
|
|
||||||
{%- set sub_title_level = title_level|slice(1) -%}
|
|
||||||
{% endif %}
|
|
||||||
{% if sub_title_level == '=' %}
|
|
||||||
{%- set sub_title_level = '' -%}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{#{% for tagName,tags in structure.tags if tagName in ['code-example'] %}#}
|
|
||||||
{#{% if loop.first %}#}
|
|
||||||
{#{{title_level}} Examples {{title_level}}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% for tag in tags %}#}
|
|
||||||
{#{%- set descToken = tag.description|split("\n", 2) -%}#}
|
|
||||||
{#{%- set title = descToken[0] -%}#}
|
|
||||||
{#{%- set code = descToken[1] -%}#}
|
|
||||||
{#{{sub_title_level}} {{ title }} {{sub_title_level}}#}
|
|
||||||
{#<code php>{{ code|raw }}</code>#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['example'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} Examples {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{{ sub_title_level }} {{ tag.filePath|escape }}{{ sub_title_level }}
|
|
||||||
<code php>{{ tag.description|raw }}</code>
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if (node.parent is null) %}
|
|
||||||
{{title_level}} File {{ structure.path }} {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if (node.parent is not null and structure.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}
|
|
||||||
{{title_level}} Inherited from {{title_level}}
|
|
||||||
[[{{structure.parent}}|{{structure.parent}}]]
|
|
||||||
{% endif %}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{% for structure in structures|sort_asc if structure.tags['internal'] is not defined and (structure.tags['api'] is defined or structure.tags['api-advanced'] is defined or structure.tags['overwritable-hook'] is defined or structure.tags['extension-hook'] is defined ) %}
|
|
||||||
{#{{ structure|raw }}#}
|
|
||||||
|
|
||||||
{% set structureName = structure|trim('\\', 'left') %}
|
|
||||||
|
|
||||||
<WRAP group box>
|
|
||||||
<WRAP twothirds column >
|
|
||||||
==== {{ structureName }} ====
|
|
||||||
</WRAP>{# twothirds column#}
|
|
||||||
|
|
||||||
<WRAP third column>
|
|
||||||
{% if structure.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
|
||||||
{% if structure.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
|
||||||
{% if structure.final %}<wrap notice>final</wrap>{% endif %}
|
|
||||||
{% if (node.parent is not null and structure.parent.fullyQualifiedStructuralElementName != node.fullyQualifiedStructuralElementName) %}<wrap notice>inherited</wrap> {% endif %}
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:structure, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
|
|
||||||
{{ structure.summary|raw }}
|
|
||||||
[[{{structureName}}|More information]]
|
|
||||||
|
|
||||||
</WRAP>{# group #}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{%- set title_level='==' -%}
|
|
||||||
{% endif %}
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['link', 'see'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} See also {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{%- set linkTag = tag.reference|trim('\\', 'left') -%}
|
|
||||||
{% if not('()' in linkTag or '$' in linkTag or node.name in linkTag or '::' in linkTag ) %}
|
|
||||||
{%- set linkTag = linkTag|lower -%}
|
|
||||||
{% elseif node.name~'::' in linkTag %}
|
|
||||||
{%- set linkTag = linkTag|replace({(node.name~'::'): '#'})|lower -%}
|
|
||||||
{% elseif '::' in linkTag -%}
|
|
||||||
{%- set linkTag = linkTag|replace({'::': '#'})|lower -%}
|
|
||||||
{% else %}
|
|
||||||
{%- set linkTag = '#' ~ linkTag|lower -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{% if tag.reference is not empty -%}
|
|
||||||
[[{{linkTag}}|{{ (tag.reference)|trim('\\', 'left') }}]] {% if tag.description|trim is not empty %}: {{ tag.description|trim('\\', 'left') }} {% endif %}
|
|
||||||
{%- else -%}
|
|
||||||
{#{{ tag.description|trim('\\', 'left') }}#}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
{% if tag is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set tag = "api" -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{% if hidden_by is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% for method in methods|sort_asc
|
|
||||||
if (method.visibility == 'public')
|
|
||||||
and (
|
|
||||||
method.tags[tag] is defined
|
|
||||||
and (
|
|
||||||
hidden_by[tag] is not defined or method.tags[hidden_by[tag]] is not defined
|
|
||||||
)
|
|
||||||
)
|
|
||||||
%}
|
|
||||||
{%- if loop.first %}
|
|
||||||
{% if tag == 'api' %}
|
|
||||||
===== API synthesis =====
|
|
||||||
<WRAP>
|
|
||||||
List of the public API methods.
|
|
||||||
When manipulating {{ node.name }}, You can call those methods:
|
|
||||||
</WRAP>
|
|
||||||
{% elseif tag == 'api-advanced' %}
|
|
||||||
===== Advanced API synthesis =====
|
|
||||||
<WRAP>
|
|
||||||
List of advanced API methods
|
|
||||||
Beware they usage is recommended to advanced users only.
|
|
||||||
</WRAP>
|
|
||||||
{% elseif tag == 'overwritable-hook' %}
|
|
||||||
===== overwritable-hook synthesis =====
|
|
||||||
<WRAP >When inheriting from {{ node.name }},
|
|
||||||
you can overwrite those methods in order to add custom logic:
|
|
||||||
</WRAP>
|
|
||||||
{% elseif tag == 'extension-hook' %}
|
|
||||||
===== extension-hook synthesis =====
|
|
||||||
<WRAP >
|
|
||||||
When inheriting from {{ node.name }},
|
|
||||||
you can extend the behaviour of iTop by implementing:
|
|
||||||
</WRAP>
|
|
||||||
{% endif %}
|
|
||||||
{% endif %}
|
|
||||||
{% set sanitizedMethod = method|trim('\\', 'left')|replace({(node.name~'::'): ''}) %}
|
|
||||||
{% if '::' in sanitizedMethod -%}
|
|
||||||
{%- if node.tags['phpdoc-tuning-exclude-inherited'] is not defined %}
|
|
||||||
* [[{{sanitizedMethod|replace({'::': '#'})|lower}}|↪{{sanitizedMethod}}]] — {{ method.summary|replace({"\n":""})|raw }}
|
|
||||||
{% endif %}
|
|
||||||
{%- else %}
|
|
||||||
* [[#{{sanitizedMethod}}|{{sanitizedMethod}}]] — {{ method.summary|replace({"\n":""})|raw }}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level = '==' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{%- for tagName,tags in structure.tags if tagName in tagsWithDescription -%}
|
|
||||||
{%- for tag in tags -%}
|
|
||||||
{%- if tag.description is not empty -%}
|
|
||||||
{%- if WRAP is defined -%}
|
|
||||||
<WRAP {{WRAP}}>
|
|
||||||
{%- endif -%}
|
|
||||||
{{title_level}} {{ tagName }} {{title_level}}
|
|
||||||
{{ tag.description|escape }}
|
|
||||||
{%- if WRAP is defined -%}
|
|
||||||
</WRAP>
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endif -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
{%- endfor -%}
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='=====' %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if blacklist is not defined %}
|
|
||||||
{% set blacklist =['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'api', 'api-advanced', 'todo', 'code-example'] %}
|
|
||||||
{% endif %}
|
|
||||||
{% if hidden_by is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{#^ {% for tagName,tags in structure.tags if tagName not in blacklist -%}#}
|
|
||||||
{#{{ tagName }} ^#}
|
|
||||||
{#{%- endfor %}#}
|
|
||||||
|
|
||||||
{% for tagName,tags in structure.tags if tagName not in blacklist and (hidden_by[tagName] is not defined or structure.tags[hidden_by[tagName]] is not defined) %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
{{title_level}} Tags {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
^ {{ tagName }} | {% for tag in tags %}{{ tag.version ? tag.version ~ ' ' : '' }}{{ tag.description}}{% endfor %} |
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='' %}
|
|
||||||
{% endif %}
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['used-by'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} Used by {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ tag.reference ?: tag.link }} : {{ tag.description ?: tag.reference }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% for tagName,tags in method.tags if tagName in ['uses'] %}#}
|
|
||||||
{#{% if loop.first %}#}
|
|
||||||
{#<dt>Uses</dt>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% for tag in tags %}#}
|
|
||||||
{#<dd>{{ tag.reference|raw }}</dd>#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
{% if title_level is not defined %}
|
|
||||||
{% set title_level='' %}
|
|
||||||
{% endif %}
|
|
||||||
{% for tagName,tags in structure.tags if tagName in ['uses'] %}
|
|
||||||
{% if loop.first %}
|
|
||||||
{{title_level}} Uses {{title_level}}
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in tags %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ tag.reference ?: tag.link }} : {{ tag.description ?: tag.reference }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% for tagName,tags in method.tags if tagName in ['uses'] %}#}
|
|
||||||
{#{% if loop.first %}#}
|
|
||||||
{#<dt>Uses</dt>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% for tag in tags %}#}
|
|
||||||
{#<dd>{{ tag.reference|raw }}</dd>#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
{% if wrap is not defined -%}
|
|
||||||
{% set wrap = 'notice' %}
|
|
||||||
{%- endif -%}
|
|
||||||
{% if hidden_by is not defined -%}
|
|
||||||
{# Do not display @api if @api-advanced is also present #}
|
|
||||||
{%- set hidden_by = {"api" : "api-advanced"} -%}
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{%- for tagName,tags in structure.tags if tagName in wrapTags and (hidden_by[tagName] is not defined or structure.tags[hidden_by[tagName]] is not defined) %}
|
|
||||||
<wrap {{wrap}}>{{tagName}}</wrap>
|
|
||||||
{% endfor %}
|
|
||||||
@@ -1,121 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
|
|
||||||
{% if node.tags['internal'] is defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This interface is "internal", and thus is not documented!</WRAP>
|
|
||||||
{% elseif node.tags['api'] is not defined and node.tags['api-advanced'] is not defined and node.tags['overwritable-hook'] is not defined and node.tags['extension-hook'] is not defined %}
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
<WRAP alert>This interface is neither "api", "overwritable-hook" or "extension-hook", and thus is not documented!</WRAP>
|
|
||||||
{% else %}
|
|
||||||
|
|
||||||
====== {{ node.name }} ======
|
|
||||||
|
|
||||||
{% if node.deprecated %}<wrap danger>deprecated</wrap>{% endif %}
|
|
||||||
{% if node.abstract %}<wrap warning>abstract</wrap>{% endif %}
|
|
||||||
{% if node.final %}<wrap notice>final</wrap>{% endif %}
|
|
||||||
{% include 'includes/wrap-tags.txt.twig' with {structure:node, wrap: 'safety', wrapTags: ['api', 'api-advanced', 'overwritable-hook', 'extension-hook']} %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% if node.deprecated %}
|
|
||||||
=== **<del>Deprecated</del>**===
|
|
||||||
//{{ node.tags.deprecated[0].description }}//
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
== {{ node.summary|replace({"\n":""})|raw }} ==
|
|
||||||
<html>{{ node.description|markdown|raw }}</html>
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/code-examples.txt.twig' with {structure:node, title_level: '====='} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% set class = node.parent %}
|
|
||||||
{% block hierarchy_element %}
|
|
||||||
|
|
||||||
{% if class and class.name is defined and class.name|trim != '' %}
|
|
||||||
==== parent ====
|
|
||||||
{% set child = class %}
|
|
||||||
{% set class = class.parent %}
|
|
||||||
{{ block('hierarchy_element') }}
|
|
||||||
[[{{ child.name }}|{{ child.name }}]]
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for interface in node.interfaces|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Implements ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ interface.fullyQualifiedStructuralElementName ?: interface }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% for trait in node.usedTraits|sort_asc %}
|
|
||||||
{% if loop.first %}
|
|
||||||
==== Uses traits ====
|
|
||||||
{% endif %}
|
|
||||||
{% if loop.length > 1 %} * {% endif %}{{ trait.fullyQualifiedStructuralElementName ?: trait }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
{% include 'includes/see-also.txt.twig' with {structure:node, title_level: '==='} %}
|
|
||||||
|
|
||||||
{% include 'includes/tags.txt.twig' with {structure:node, title_level: '=====', blacklist: ['link', 'see', 'abstract', 'example', 'method', 'property', 'property-read', 'property-write', 'package', 'subpackage', 'phpdoc-tuning-exclude-inherited', 'api', 'api-advanced', 'overwritable-hook', 'extension-hook', 'copyright', 'license', 'code-example']} %}
|
|
||||||
|
|
||||||
|
|
||||||
{% set methods = node.inheritedMethods.merge(node.methods) %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'api-advanced'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'overwritable-hook'} %}
|
|
||||||
{% include 'includes/tag-synthesys.txt.twig' with {methods:methods, tag:'extension-hook'} %}
|
|
||||||
|
|
||||||
<WRAP clear />
|
|
||||||
|
|
||||||
|
|
||||||
{% for method in methods|sort_asc if method.visibility == 'public' %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Public methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% for method in methods|sort_asc if method.visibility == 'protected' %}
|
|
||||||
{%- if loop.first %}
|
|
||||||
===== Protected methods =====
|
|
||||||
{% endif %}
|
|
||||||
{{ block('method') }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% set constants = node.inheritedConstants.merge(node.constants) %}
|
|
||||||
{% if constants|length > 0 %}
|
|
||||||
===== Constants =====
|
|
||||||
{% for constant in constants|sort_asc %}
|
|
||||||
{{ block('constant') }}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
{#{% set properties = node.inheritedProperties.merge(node.properties) %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'public' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Public properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% for property in properties|sort_asc if property.visibility == 'protected' %}#}
|
|
||||||
{#{%- if loop.first %}#}
|
|
||||||
{#===== Protected properties =====#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{{ block('property') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
|
|
||||||
{%- endif %} {#{% elseif node.tags['xxx'] is not defined and ... #}
|
|
||||||
|
|
||||||
<wrap button>[[start|🔙 Back]]</wrap>
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{% use 'elements/constant.txt.twig' %}
|
|
||||||
{% use 'elements/property.txt.twig' %}
|
|
||||||
{% use 'elements/method.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}{% endblock %}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
{% extends 'layout.txt.twig' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% set namespace = project.namespace %}
|
|
||||||
{{ block('sidebarNamespaces') }}
|
|
||||||
|
|
||||||
{#{{ node.parent|raw }}#}
|
|
||||||
{#====== {{ node.parent.fullyQualifiedStructuralElementName }}{{ node.name }} ======#}
|
|
||||||
|
|
||||||
{% if node.children|length > 0 %}
|
|
||||||
=====Namespaces=====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.children} %}
|
|
||||||
----
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.traits|length > 0 %}
|
|
||||||
===== Traits =====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.traits} %}
|
|
||||||
----
|
|
||||||
{%- endif %}
|
|
||||||
|
|
||||||
{% if node.interfaces|length > 0 %}
|
|
||||||
===== Interfaces =====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.interfaces} %}
|
|
||||||
----
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if node.classes|length > 0 %}
|
|
||||||
===== Classes =====
|
|
||||||
{% include 'includes/namespace-structure-toc.html.twig' with {structures: node.classes} %}
|
|
||||||
----
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{#{% if node.constants|length > 0 %}#}
|
|
||||||
{#===== Constants =====#}
|
|
||||||
{#{% for constant in node.constants|sort_asc %}#}
|
|
||||||
{# {{ block('constant') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
{#{% if node.functions|length > 0 %}#}
|
|
||||||
{#===== Functions =====#}
|
|
||||||
|
|
||||||
{#{% for method in node.functions|sort_asc %}#}
|
|
||||||
{# {{ block('method') }}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
|
|
||||||
====== Deprecated elements ======
|
|
||||||
|
|
||||||
{#{% for element in project.indexes.elements if element.deprecated %}#}
|
|
||||||
{#{% if element.file.path != previousPath %}#}
|
|
||||||
{#<li><a href="#{{ element.file.path }}"><i class="icon-file"></i> {{ element.file.path }}</a></li>#}
|
|
||||||
{#{% endif %}#}
|
|
||||||
{#{% set previousPath = element.file.path %}#}
|
|
||||||
{#{% endfor %}#}
|
|
||||||
|
|
||||||
{% for element in project.indexes.elements if element.deprecated %}
|
|
||||||
{% if element.file.path != previousPath %}
|
|
||||||
{% if previousPath %}
|
|
||||||
</WRAP>{# group #}
|
|
||||||
{% endif %}
|
|
||||||
{#<a name="{{ element.file.path }}" id="{{ element.file.path }}"></a>#}
|
|
||||||
===== {{ element.file.path }} ({{ element.tags.deprecated.count }} found)=====
|
|
||||||
|
|
||||||
<WRAP group >
|
|
||||||
<WRAP third column >
|
|
||||||
Element
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
Line
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
Description
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
{% for tag in element.tags.deprecated %}
|
|
||||||
<WRAP group >
|
|
||||||
<WRAP third column >
|
|
||||||
{{ element.fullyQualifiedStructuralElementName }}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
{{ element.line }}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
<WRAP third column >
|
|
||||||
{{ tag.description }}
|
|
||||||
</WRAP>{# third column#}
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
</WRAP>{# group #}
|
|
||||||
{% set previousPath = element.file.path %}
|
|
||||||
{% else %}
|
|
||||||
<WRAP info>No deprecated elements have been found in this project.</WRAP>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<template>
|
|
||||||
<author>Bruno DA SILVA</author>
|
|
||||||
<email>contact [at] combodo.com</email>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<copyright>Combodo 2018</copyright>
|
|
||||||
<description><![CDATA[
|
|
||||||
|
|
||||||
Forked from the clean theme of https://github.com/phpDocumentor/phpDocumentor2 provided under the MIT licence.
|
|
||||||
The original work is copyright "Mike van Riel".
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
To improve performance you can add the following to your .htaccess:
|
|
||||||
|
|
||||||
<ifModule mod_deflate.c>
|
|
||||||
<filesMatch "\.(js|css|html)$">
|
|
||||||
SetOutputFilter DEFLATE
|
|
||||||
</filesMatch>
|
|
||||||
</ifModule>
|
|
||||||
]]></description>
|
|
||||||
<transformations>
|
|
||||||
<transformation writer="twig" query="namespace" source="templates/combodo-wiki/namespace.txt.twig" artifact="start.txt"/>
|
|
||||||
<transformation writer="twig" query="indexes.classes" source="templates/combodo-wiki/class.txt.twig" artifact="{{name}}.txt"/>
|
|
||||||
<transformation writer="twig" query="indexes.interfaces" source="templates/combodo-wiki/interface.txt.twig" artifact="{{name}}.txt" />
|
|
||||||
</transformations>
|
|
||||||
</template>
|
|
||||||
575
.editorconfig
575
.editorconfig
@@ -1,575 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
|
||||||
indent_size = 4
|
|
||||||
indent_style = space
|
|
||||||
insert_final_newline = false
|
|
||||||
max_line_length = 300
|
|
||||||
tab_width = 4
|
|
||||||
ij_continuation_indent_size = 8
|
|
||||||
ij_formatter_off_tag = @formatter:off
|
|
||||||
ij_formatter_on_tag = @formatter:on
|
|
||||||
ij_formatter_tags_enabled = true
|
|
||||||
ij_smart_tabs = false
|
|
||||||
ij_visual_guides = 300
|
|
||||||
ij_wrap_on_typing = true
|
|
||||||
|
|
||||||
[*.css]
|
|
||||||
indent_style = tab
|
|
||||||
ij_smart_tabs = true
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_css_align_closing_brace_with_properties = false
|
|
||||||
ij_css_blank_lines_around_nested_selector = 1
|
|
||||||
ij_css_blank_lines_between_blocks = 1
|
|
||||||
ij_css_brace_placement = end_of_line
|
|
||||||
ij_css_enforce_quotes_on_format = false
|
|
||||||
ij_css_hex_color_long_format = false
|
|
||||||
ij_css_hex_color_lower_case = false
|
|
||||||
ij_css_hex_color_short_format = false
|
|
||||||
ij_css_hex_color_upper_case = false
|
|
||||||
ij_css_keep_blank_lines_in_code = 2
|
|
||||||
ij_css_keep_indents_on_empty_lines = false
|
|
||||||
ij_css_keep_single_line_blocks = false
|
|
||||||
ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
|
|
||||||
ij_css_space_after_colon = true
|
|
||||||
ij_css_space_before_opening_brace = true
|
|
||||||
ij_css_use_double_quotes = true
|
|
||||||
ij_css_value_alignment = do_not_align
|
|
||||||
|
|
||||||
[*.scss]
|
|
||||||
indent_size = 2
|
|
||||||
tab_width = 2
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_scss_align_closing_brace_with_properties = false
|
|
||||||
ij_scss_blank_lines_around_nested_selector = 1
|
|
||||||
ij_scss_blank_lines_between_blocks = 1
|
|
||||||
ij_scss_brace_placement = 0
|
|
||||||
ij_scss_enforce_quotes_on_format = false
|
|
||||||
ij_scss_hex_color_long_format = false
|
|
||||||
ij_scss_hex_color_lower_case = false
|
|
||||||
ij_scss_hex_color_short_format = false
|
|
||||||
ij_scss_hex_color_upper_case = false
|
|
||||||
ij_scss_keep_blank_lines_in_code = 2
|
|
||||||
ij_scss_keep_indents_on_empty_lines = false
|
|
||||||
ij_scss_keep_single_line_blocks = false
|
|
||||||
ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow
|
|
||||||
ij_scss_space_after_colon = true
|
|
||||||
ij_scss_space_before_opening_brace = true
|
|
||||||
ij_scss_use_double_quotes = true
|
|
||||||
ij_scss_value_alignment = 0
|
|
||||||
|
|
||||||
[*.twig]
|
|
||||||
ij_smart_tabs = true
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_wrap_on_typing = false
|
|
||||||
ij_twig_keep_indents_on_empty_lines = false
|
|
||||||
ij_twig_spaces_inside_comments_delimiters = true
|
|
||||||
ij_twig_spaces_inside_delimiters = true
|
|
||||||
ij_twig_spaces_inside_variable_delimiters = true
|
|
||||||
|
|
||||||
[.editorconfig]
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_editorconfig_align_group_field_declarations = false
|
|
||||||
ij_editorconfig_space_after_colon = false
|
|
||||||
ij_editorconfig_space_after_comma = true
|
|
||||||
ij_editorconfig_space_before_colon = false
|
|
||||||
ij_editorconfig_space_before_comma = false
|
|
||||||
ij_editorconfig_spaces_around_assignment_operators = true
|
|
||||||
|
|
||||||
[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.rng,*.tld,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,phpunit.xml.dist}]
|
|
||||||
indent_size = 2
|
|
||||||
tab_width = 2
|
|
||||||
ij_smart_tabs = true
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_wrap_on_typing = false
|
|
||||||
ij_xml_align_attributes = true
|
|
||||||
ij_xml_align_text = false
|
|
||||||
ij_xml_attribute_wrap = normal
|
|
||||||
ij_xml_block_comment_at_first_column = true
|
|
||||||
ij_xml_keep_blank_lines = 2
|
|
||||||
ij_xml_keep_indents_on_empty_lines = false
|
|
||||||
ij_xml_keep_line_breaks = true
|
|
||||||
ij_xml_keep_line_breaks_in_text = true
|
|
||||||
ij_xml_keep_whitespaces = false
|
|
||||||
ij_xml_keep_whitespaces_around_cdata = preserve
|
|
||||||
ij_xml_keep_whitespaces_inside_cdata = true
|
|
||||||
ij_xml_line_comment_at_first_column = true
|
|
||||||
ij_xml_space_after_tag_name = false
|
|
||||||
ij_xml_space_around_equals_in_attribute = false
|
|
||||||
ij_xml_space_inside_empty_tag = false
|
|
||||||
ij_xml_text_wrap = off
|
|
||||||
|
|
||||||
[{*.bash,*.sh,*.zsh}]
|
|
||||||
indent_size = 2
|
|
||||||
tab_width = 2
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_shell_binary_ops_start_line = false
|
|
||||||
ij_shell_keep_column_alignment_padding = false
|
|
||||||
ij_shell_minify_program = false
|
|
||||||
ij_shell_redirect_followed_by_space = false
|
|
||||||
ij_shell_switch_cases_indented = false
|
|
||||||
ij_shell_use_unix_line_separator = true
|
|
||||||
|
|
||||||
[{*.cjs,*.js}]
|
|
||||||
indent_style = tab
|
|
||||||
ij_continuation_indent_size = 4
|
|
||||||
ij_smart_tabs = true
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_javascript_align_imports = false
|
|
||||||
ij_javascript_align_multiline_array_initializer_expression = false
|
|
||||||
ij_javascript_align_multiline_binary_operation = false
|
|
||||||
ij_javascript_align_multiline_chained_methods = false
|
|
||||||
ij_javascript_align_multiline_extends_list = false
|
|
||||||
ij_javascript_align_multiline_for = true
|
|
||||||
ij_javascript_align_multiline_parameters = true
|
|
||||||
ij_javascript_align_multiline_parameters_in_calls = false
|
|
||||||
ij_javascript_align_multiline_ternary_operation = false
|
|
||||||
ij_javascript_align_object_properties = 0
|
|
||||||
ij_javascript_align_union_types = false
|
|
||||||
ij_javascript_align_var_statements = 0
|
|
||||||
ij_javascript_array_initializer_new_line_after_left_brace = false
|
|
||||||
ij_javascript_array_initializer_right_brace_on_new_line = false
|
|
||||||
ij_javascript_array_initializer_wrap = off
|
|
||||||
ij_javascript_assignment_wrap = off
|
|
||||||
ij_javascript_binary_operation_sign_on_next_line = false
|
|
||||||
ij_javascript_binary_operation_wrap = off
|
|
||||||
ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**,**/node_modules/**,@angular/material,@angular/material/typings/**
|
|
||||||
ij_javascript_blank_lines_after_imports = 1
|
|
||||||
ij_javascript_blank_lines_around_class = 1
|
|
||||||
ij_javascript_blank_lines_around_field = 0
|
|
||||||
ij_javascript_blank_lines_around_function = 1
|
|
||||||
ij_javascript_blank_lines_around_method = 1
|
|
||||||
ij_javascript_block_brace_style = end_of_line
|
|
||||||
ij_javascript_call_parameters_new_line_after_left_paren = false
|
|
||||||
ij_javascript_call_parameters_right_paren_on_new_line = false
|
|
||||||
ij_javascript_call_parameters_wrap = off
|
|
||||||
ij_javascript_catch_on_new_line = false
|
|
||||||
ij_javascript_chained_call_dot_on_new_line = true
|
|
||||||
ij_javascript_class_brace_style = end_of_line
|
|
||||||
ij_javascript_comma_on_new_line = false
|
|
||||||
ij_javascript_do_while_brace_force = always
|
|
||||||
ij_javascript_else_on_new_line = false
|
|
||||||
ij_javascript_enforce_trailing_comma = keep
|
|
||||||
ij_javascript_extends_keyword_wrap = off
|
|
||||||
ij_javascript_extends_list_wrap = off
|
|
||||||
ij_javascript_field_prefix = _
|
|
||||||
ij_javascript_file_name_style = relaxed
|
|
||||||
ij_javascript_finally_on_new_line = false
|
|
||||||
ij_javascript_for_brace_force = always
|
|
||||||
ij_javascript_for_statement_new_line_after_left_paren = false
|
|
||||||
ij_javascript_for_statement_right_paren_on_new_line = false
|
|
||||||
ij_javascript_for_statement_wrap = off
|
|
||||||
ij_javascript_force_quote_style = false
|
|
||||||
ij_javascript_force_semicolon_style = false
|
|
||||||
ij_javascript_function_expression_brace_style = end_of_line
|
|
||||||
ij_javascript_if_brace_force = always
|
|
||||||
ij_javascript_import_merge_members = global
|
|
||||||
ij_javascript_import_prefer_absolute_path = global
|
|
||||||
ij_javascript_import_sort_members = true
|
|
||||||
ij_javascript_import_sort_module_name = false
|
|
||||||
ij_javascript_import_use_node_resolution = true
|
|
||||||
ij_javascript_imports_wrap = on_every_item
|
|
||||||
ij_javascript_indent_case_from_switch = true
|
|
||||||
ij_javascript_indent_chained_calls = true
|
|
||||||
ij_javascript_indent_package_children = 0
|
|
||||||
ij_javascript_jsx_attribute_value = braces
|
|
||||||
ij_javascript_keep_blank_lines_in_code = 2
|
|
||||||
ij_javascript_keep_first_column_comment = true
|
|
||||||
ij_javascript_keep_indents_on_empty_lines = false
|
|
||||||
ij_javascript_keep_line_breaks = true
|
|
||||||
ij_javascript_keep_simple_blocks_in_one_line = false
|
|
||||||
ij_javascript_keep_simple_methods_in_one_line = false
|
|
||||||
ij_javascript_line_comment_add_space = true
|
|
||||||
ij_javascript_line_comment_at_first_column = false
|
|
||||||
ij_javascript_method_brace_style = end_of_line
|
|
||||||
ij_javascript_method_call_chain_wrap = off
|
|
||||||
ij_javascript_method_parameters_new_line_after_left_paren = false
|
|
||||||
ij_javascript_method_parameters_right_paren_on_new_line = false
|
|
||||||
ij_javascript_method_parameters_wrap = off
|
|
||||||
ij_javascript_object_literal_wrap = on_every_item
|
|
||||||
ij_javascript_parentheses_expression_new_line_after_left_paren = false
|
|
||||||
ij_javascript_parentheses_expression_right_paren_on_new_line = false
|
|
||||||
ij_javascript_place_assignment_sign_on_next_line = false
|
|
||||||
ij_javascript_prefer_as_type_cast = false
|
|
||||||
ij_javascript_prefer_explicit_types_function_expression_returns = false
|
|
||||||
ij_javascript_prefer_explicit_types_function_returns = false
|
|
||||||
ij_javascript_prefer_explicit_types_vars_fields = false
|
|
||||||
ij_javascript_prefer_parameters_wrap = false
|
|
||||||
ij_javascript_reformat_c_style_comments = false
|
|
||||||
ij_javascript_space_after_colon = true
|
|
||||||
ij_javascript_space_after_comma = true
|
|
||||||
ij_javascript_space_after_dots_in_rest_parameter = false
|
|
||||||
ij_javascript_space_after_generator_mult = true
|
|
||||||
ij_javascript_space_after_property_colon = true
|
|
||||||
ij_javascript_space_after_quest = true
|
|
||||||
ij_javascript_space_after_type_colon = true
|
|
||||||
ij_javascript_space_after_unary_not = false
|
|
||||||
ij_javascript_space_before_async_arrow_lparen = true
|
|
||||||
ij_javascript_space_before_catch_keyword = true
|
|
||||||
ij_javascript_space_before_catch_left_brace = true
|
|
||||||
ij_javascript_space_before_catch_parentheses = true
|
|
||||||
ij_javascript_space_before_class_lbrace = true
|
|
||||||
ij_javascript_space_before_class_left_brace = true
|
|
||||||
ij_javascript_space_before_colon = true
|
|
||||||
ij_javascript_space_before_comma = false
|
|
||||||
ij_javascript_space_before_do_left_brace = true
|
|
||||||
ij_javascript_space_before_else_keyword = true
|
|
||||||
ij_javascript_space_before_else_left_brace = true
|
|
||||||
ij_javascript_space_before_finally_keyword = true
|
|
||||||
ij_javascript_space_before_finally_left_brace = true
|
|
||||||
ij_javascript_space_before_for_left_brace = true
|
|
||||||
ij_javascript_space_before_for_parentheses = true
|
|
||||||
ij_javascript_space_before_for_semicolon = false
|
|
||||||
ij_javascript_space_before_function_left_parenth = true
|
|
||||||
ij_javascript_space_before_generator_mult = false
|
|
||||||
ij_javascript_space_before_if_left_brace = true
|
|
||||||
ij_javascript_space_before_if_parentheses = true
|
|
||||||
ij_javascript_space_before_method_call_parentheses = false
|
|
||||||
ij_javascript_space_before_method_left_brace = true
|
|
||||||
ij_javascript_space_before_method_parentheses = false
|
|
||||||
ij_javascript_space_before_property_colon = false
|
|
||||||
ij_javascript_space_before_quest = true
|
|
||||||
ij_javascript_space_before_switch_left_brace = true
|
|
||||||
ij_javascript_space_before_switch_parentheses = true
|
|
||||||
ij_javascript_space_before_try_left_brace = true
|
|
||||||
ij_javascript_space_before_type_colon = false
|
|
||||||
ij_javascript_space_before_unary_not = false
|
|
||||||
ij_javascript_space_before_while_keyword = true
|
|
||||||
ij_javascript_space_before_while_left_brace = true
|
|
||||||
ij_javascript_space_before_while_parentheses = true
|
|
||||||
ij_javascript_spaces_around_additive_operators = false
|
|
||||||
ij_javascript_spaces_around_arrow_function_operator = true
|
|
||||||
ij_javascript_spaces_around_assignment_operators = true
|
|
||||||
ij_javascript_spaces_around_bitwise_operators = true
|
|
||||||
ij_javascript_spaces_around_equality_operators = true
|
|
||||||
ij_javascript_spaces_around_logical_operators = true
|
|
||||||
ij_javascript_spaces_around_multiplicative_operators = true
|
|
||||||
ij_javascript_spaces_around_relational_operators = true
|
|
||||||
ij_javascript_spaces_around_shift_operators = true
|
|
||||||
ij_javascript_spaces_around_unary_operator = false
|
|
||||||
ij_javascript_spaces_within_array_initializer_brackets = false
|
|
||||||
ij_javascript_spaces_within_brackets = false
|
|
||||||
ij_javascript_spaces_within_catch_parentheses = false
|
|
||||||
ij_javascript_spaces_within_for_parentheses = false
|
|
||||||
ij_javascript_spaces_within_if_parentheses = false
|
|
||||||
ij_javascript_spaces_within_imports = false
|
|
||||||
ij_javascript_spaces_within_interpolation_expressions = false
|
|
||||||
ij_javascript_spaces_within_method_call_parentheses = false
|
|
||||||
ij_javascript_spaces_within_method_parentheses = false
|
|
||||||
ij_javascript_spaces_within_object_literal_braces = false
|
|
||||||
ij_javascript_spaces_within_object_type_braces = true
|
|
||||||
ij_javascript_spaces_within_parentheses = false
|
|
||||||
ij_javascript_spaces_within_switch_parentheses = false
|
|
||||||
ij_javascript_spaces_within_type_assertion = false
|
|
||||||
ij_javascript_spaces_within_union_types = true
|
|
||||||
ij_javascript_spaces_within_while_parentheses = false
|
|
||||||
ij_javascript_special_else_if_treatment = true
|
|
||||||
ij_javascript_ternary_operation_signs_on_next_line = false
|
|
||||||
ij_javascript_ternary_operation_wrap = off
|
|
||||||
ij_javascript_union_types_wrap = on_every_item
|
|
||||||
ij_javascript_use_chained_calls_group_indents = true
|
|
||||||
ij_javascript_use_double_quotes = true
|
|
||||||
ij_javascript_use_explicit_js_extension = global
|
|
||||||
ij_javascript_use_path_mapping = always
|
|
||||||
ij_javascript_use_public_modifier = false
|
|
||||||
ij_javascript_use_semicolon_after_statement = true
|
|
||||||
ij_javascript_var_declaration_wrap = normal
|
|
||||||
ij_javascript_while_brace_force = always
|
|
||||||
ij_javascript_while_on_new_line = false
|
|
||||||
ij_javascript_wrap_comments = false
|
|
||||||
|
|
||||||
[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}]
|
|
||||||
indent_style = tab
|
|
||||||
ij_continuation_indent_size = 4
|
|
||||||
ij_smart_tabs = true
|
|
||||||
ij_wrap_on_typing = false
|
|
||||||
ij_php_align_assignments = false
|
|
||||||
ij_php_align_class_constants = true
|
|
||||||
ij_php_align_group_field_declarations = false
|
|
||||||
ij_php_align_inline_comments = false
|
|
||||||
ij_php_align_key_value_pairs = true
|
|
||||||
ij_php_align_match_arm_bodies = false
|
|
||||||
ij_php_align_multiline_array_initializer_expression = true
|
|
||||||
ij_php_align_multiline_binary_operation = false
|
|
||||||
ij_php_align_multiline_chained_methods = false
|
|
||||||
ij_php_align_multiline_extends_list = false
|
|
||||||
ij_php_align_multiline_for = true
|
|
||||||
ij_php_align_multiline_parameters = false
|
|
||||||
ij_php_align_multiline_parameters_in_calls = false
|
|
||||||
ij_php_align_multiline_ternary_operation = false
|
|
||||||
ij_php_align_named_arguments = false
|
|
||||||
ij_php_align_phpdoc_comments = false
|
|
||||||
ij_php_align_phpdoc_param_names = false
|
|
||||||
ij_php_anonymous_brace_style = end_of_line
|
|
||||||
ij_php_api_weight = 1
|
|
||||||
ij_php_array_initializer_new_line_after_left_brace = true
|
|
||||||
ij_php_array_initializer_right_brace_on_new_line = true
|
|
||||||
ij_php_array_initializer_wrap = on_every_item
|
|
||||||
ij_php_assignment_wrap = off
|
|
||||||
ij_php_attributes_wrap = off
|
|
||||||
ij_php_author_weight = 8
|
|
||||||
ij_php_binary_operation_sign_on_next_line = false
|
|
||||||
ij_php_binary_operation_wrap = off
|
|
||||||
ij_php_blank_lines_after_class_header = 0
|
|
||||||
ij_php_blank_lines_after_function = 1
|
|
||||||
ij_php_blank_lines_after_imports = 1
|
|
||||||
ij_php_blank_lines_after_opening_tag = 0
|
|
||||||
ij_php_blank_lines_after_package = 1
|
|
||||||
ij_php_blank_lines_around_class = 1
|
|
||||||
ij_php_blank_lines_around_constants = 0
|
|
||||||
ij_php_blank_lines_around_field = 0
|
|
||||||
ij_php_blank_lines_around_method = 1
|
|
||||||
ij_php_blank_lines_before_class_end = 0
|
|
||||||
ij_php_blank_lines_before_imports = 1
|
|
||||||
ij_php_blank_lines_before_method_body = 0
|
|
||||||
ij_php_blank_lines_before_package = 1
|
|
||||||
ij_php_blank_lines_before_return_statement = 1
|
|
||||||
ij_php_blank_lines_between_imports = 0
|
|
||||||
ij_php_block_brace_style = end_of_line
|
|
||||||
ij_php_call_parameters_new_line_after_left_paren = false
|
|
||||||
ij_php_call_parameters_right_paren_on_new_line = false
|
|
||||||
ij_php_call_parameters_wrap = normal
|
|
||||||
ij_php_catch_on_new_line = true
|
|
||||||
ij_php_category_weight = 28
|
|
||||||
ij_php_class_brace_style = next_line
|
|
||||||
ij_php_comma_after_last_array_element = true
|
|
||||||
ij_php_concat_spaces = false
|
|
||||||
ij_php_copyright_weight = 28
|
|
||||||
ij_php_deprecated_weight = 2
|
|
||||||
ij_php_do_while_brace_force = always
|
|
||||||
ij_php_else_if_style = as_is
|
|
||||||
ij_php_else_on_new_line = false
|
|
||||||
ij_php_example_weight = 4
|
|
||||||
ij_php_extends_keyword_wrap = off
|
|
||||||
ij_php_extends_list_wrap = off
|
|
||||||
ij_php_fields_default_visibility = private
|
|
||||||
ij_php_filesource_weight = 28
|
|
||||||
ij_php_finally_on_new_line = true
|
|
||||||
ij_php_for_brace_force = always
|
|
||||||
ij_php_for_statement_new_line_after_left_paren = false
|
|
||||||
ij_php_for_statement_right_paren_on_new_line = false
|
|
||||||
ij_php_for_statement_wrap = off
|
|
||||||
ij_php_force_short_declaration_array_style = false
|
|
||||||
ij_php_getters_setters_naming_style = camel_case
|
|
||||||
ij_php_getters_setters_order_style = getters_first
|
|
||||||
ij_php_global_weight = 28
|
|
||||||
ij_php_group_use_wrap = on_every_item
|
|
||||||
ij_php_if_brace_force = always
|
|
||||||
ij_php_if_lparen_on_next_line = false
|
|
||||||
ij_php_if_rparen_on_next_line = false
|
|
||||||
ij_php_ignore_weight = 28
|
|
||||||
ij_php_import_sorting = alphabetic
|
|
||||||
ij_php_indent_break_from_case = true
|
|
||||||
ij_php_indent_case_from_switch = true
|
|
||||||
ij_php_indent_code_in_php_tags = false
|
|
||||||
ij_php_internal_weight = 0
|
|
||||||
ij_php_keep_blank_lines_after_lbrace = 2
|
|
||||||
ij_php_keep_blank_lines_before_right_brace = 2
|
|
||||||
ij_php_keep_blank_lines_in_code = 2
|
|
||||||
ij_php_keep_blank_lines_in_declarations = 2
|
|
||||||
ij_php_keep_control_statement_in_one_line = true
|
|
||||||
ij_php_keep_first_column_comment = true
|
|
||||||
ij_php_keep_indents_on_empty_lines = false
|
|
||||||
ij_php_keep_line_breaks = true
|
|
||||||
ij_php_keep_rparen_and_lbrace_on_one_line = false
|
|
||||||
ij_php_keep_simple_classes_in_one_line = false
|
|
||||||
ij_php_keep_simple_methods_in_one_line = false
|
|
||||||
ij_php_lambda_brace_style = end_of_line
|
|
||||||
ij_php_license_weight = 28
|
|
||||||
ij_php_line_comment_add_space = false
|
|
||||||
ij_php_line_comment_at_first_column = true
|
|
||||||
ij_php_link_weight = 28
|
|
||||||
ij_php_lower_case_boolean_const = true
|
|
||||||
ij_php_lower_case_keywords = true
|
|
||||||
ij_php_lower_case_null_const = true
|
|
||||||
ij_php_method_brace_style = next_line
|
|
||||||
ij_php_method_call_chain_wrap = off
|
|
||||||
ij_php_method_parameters_new_line_after_left_paren = true
|
|
||||||
ij_php_method_parameters_right_paren_on_new_line = true
|
|
||||||
ij_php_method_parameters_wrap = normal
|
|
||||||
ij_php_method_weight = 28
|
|
||||||
ij_php_modifier_list_wrap = false
|
|
||||||
ij_php_multiline_chained_calls_semicolon_on_new_line = false
|
|
||||||
ij_php_namespace_brace_style = 1
|
|
||||||
ij_php_new_line_after_php_opening_tag = false
|
|
||||||
ij_php_null_type_position = in_the_end
|
|
||||||
ij_php_package_weight = 28
|
|
||||||
ij_php_param_weight = 5
|
|
||||||
ij_php_parameters_attributes_wrap = off
|
|
||||||
ij_php_parentheses_expression_new_line_after_left_paren = false
|
|
||||||
ij_php_parentheses_expression_right_paren_on_new_line = false
|
|
||||||
ij_php_phpdoc_blank_line_before_tags = true
|
|
||||||
ij_php_phpdoc_blank_lines_around_parameters = true
|
|
||||||
ij_php_phpdoc_keep_blank_lines = true
|
|
||||||
ij_php_phpdoc_param_spaces_between_name_and_description = 1
|
|
||||||
ij_php_phpdoc_param_spaces_between_tag_and_type = 1
|
|
||||||
ij_php_phpdoc_param_spaces_between_type_and_name = 1
|
|
||||||
ij_php_phpdoc_use_fqcn = true
|
|
||||||
ij_php_phpdoc_wrap_long_lines = true
|
|
||||||
ij_php_place_assignment_sign_on_next_line = false
|
|
||||||
ij_php_place_parens_for_constructor = 0
|
|
||||||
ij_php_property_read_weight = 28
|
|
||||||
ij_php_property_weight = 28
|
|
||||||
ij_php_property_write_weight = 28
|
|
||||||
ij_php_return_type_on_new_line = false
|
|
||||||
ij_php_return_weight = 6
|
|
||||||
ij_php_see_weight = 3
|
|
||||||
ij_php_since_weight = 28
|
|
||||||
ij_php_sort_phpdoc_elements = true
|
|
||||||
ij_php_space_after_colon = true
|
|
||||||
ij_php_space_after_colon_in_enum_backed_type = true
|
|
||||||
ij_php_space_after_colon_in_named_argument = true
|
|
||||||
ij_php_space_after_colon_in_return_type = true
|
|
||||||
ij_php_space_after_comma = true
|
|
||||||
ij_php_space_after_for_semicolon = true
|
|
||||||
ij_php_space_after_quest = true
|
|
||||||
ij_php_space_after_type_cast = false
|
|
||||||
ij_php_space_after_unary_not = false
|
|
||||||
ij_php_space_before_array_initializer_left_brace = false
|
|
||||||
ij_php_space_before_catch_keyword = true
|
|
||||||
ij_php_space_before_catch_left_brace = true
|
|
||||||
ij_php_space_before_catch_parentheses = true
|
|
||||||
ij_php_space_before_class_left_brace = true
|
|
||||||
ij_php_space_before_closure_left_parenthesis = true
|
|
||||||
ij_php_space_before_colon = true
|
|
||||||
ij_php_space_before_colon_in_enum_backed_type = false
|
|
||||||
ij_php_space_before_colon_in_named_argument = false
|
|
||||||
ij_php_space_before_colon_in_return_type = false
|
|
||||||
ij_php_space_before_comma = false
|
|
||||||
ij_php_space_before_do_left_brace = true
|
|
||||||
ij_php_space_before_else_keyword = true
|
|
||||||
ij_php_space_before_else_left_brace = true
|
|
||||||
ij_php_space_before_finally_keyword = true
|
|
||||||
ij_php_space_before_finally_left_brace = true
|
|
||||||
ij_php_space_before_for_left_brace = true
|
|
||||||
ij_php_space_before_for_parentheses = true
|
|
||||||
ij_php_space_before_for_semicolon = false
|
|
||||||
ij_php_space_before_if_left_brace = true
|
|
||||||
ij_php_space_before_if_parentheses = true
|
|
||||||
ij_php_space_before_method_call_parentheses = false
|
|
||||||
ij_php_space_before_method_left_brace = true
|
|
||||||
ij_php_space_before_method_parentheses = false
|
|
||||||
ij_php_space_before_quest = true
|
|
||||||
ij_php_space_before_short_closure_left_parenthesis = false
|
|
||||||
ij_php_space_before_switch_left_brace = true
|
|
||||||
ij_php_space_before_switch_parentheses = true
|
|
||||||
ij_php_space_before_try_left_brace = true
|
|
||||||
ij_php_space_before_unary_not = false
|
|
||||||
ij_php_space_before_while_keyword = true
|
|
||||||
ij_php_space_before_while_left_brace = true
|
|
||||||
ij_php_space_before_while_parentheses = true
|
|
||||||
ij_php_space_between_ternary_quest_and_colon = false
|
|
||||||
ij_php_spaces_around_additive_operators = true
|
|
||||||
ij_php_spaces_around_arrow = false
|
|
||||||
ij_php_spaces_around_assignment_in_declare = false
|
|
||||||
ij_php_spaces_around_assignment_operators = true
|
|
||||||
ij_php_spaces_around_bitwise_operators = true
|
|
||||||
ij_php_spaces_around_equality_operators = true
|
|
||||||
ij_php_spaces_around_logical_operators = true
|
|
||||||
ij_php_spaces_around_multiplicative_operators = true
|
|
||||||
ij_php_spaces_around_null_coalesce_operator = true
|
|
||||||
ij_php_spaces_around_pipe_in_union_type = false
|
|
||||||
ij_php_spaces_around_relational_operators = true
|
|
||||||
ij_php_spaces_around_shift_operators = true
|
|
||||||
ij_php_spaces_around_unary_operator = false
|
|
||||||
ij_php_spaces_around_var_within_brackets = false
|
|
||||||
ij_php_spaces_within_array_initializer_braces = false
|
|
||||||
ij_php_spaces_within_brackets = false
|
|
||||||
ij_php_spaces_within_catch_parentheses = false
|
|
||||||
ij_php_spaces_within_for_parentheses = false
|
|
||||||
ij_php_spaces_within_if_parentheses = false
|
|
||||||
ij_php_spaces_within_method_call_parentheses = false
|
|
||||||
ij_php_spaces_within_method_parentheses = false
|
|
||||||
ij_php_spaces_within_parentheses = false
|
|
||||||
ij_php_spaces_within_short_echo_tags = true
|
|
||||||
ij_php_spaces_within_switch_parentheses = false
|
|
||||||
ij_php_spaces_within_while_parentheses = false
|
|
||||||
ij_php_special_else_if_treatment = true
|
|
||||||
ij_php_subpackage_weight = 28
|
|
||||||
ij_php_ternary_operation_signs_on_next_line = false
|
|
||||||
ij_php_ternary_operation_wrap = off
|
|
||||||
ij_php_throws_weight = 7
|
|
||||||
ij_php_todo_weight = 28
|
|
||||||
ij_php_unknown_tag_weight = 28
|
|
||||||
ij_php_upper_case_boolean_const = false
|
|
||||||
ij_php_upper_case_null_const = false
|
|
||||||
ij_php_uses_weight = 28
|
|
||||||
ij_php_var_weight = 28
|
|
||||||
ij_php_variable_naming_style = mixed
|
|
||||||
ij_php_version_weight = 28
|
|
||||||
ij_php_while_brace_force = always
|
|
||||||
ij_php_while_on_new_line = false
|
|
||||||
|
|
||||||
[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,composer.lock,jest.config}]
|
|
||||||
indent_size = 2
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_json_keep_blank_lines_in_code = 0
|
|
||||||
ij_json_keep_indents_on_empty_lines = false
|
|
||||||
ij_json_keep_line_breaks = true
|
|
||||||
ij_json_space_after_colon = true
|
|
||||||
ij_json_space_after_comma = true
|
|
||||||
ij_json_space_before_colon = true
|
|
||||||
ij_json_space_before_comma = false
|
|
||||||
ij_json_spaces_within_braces = false
|
|
||||||
ij_json_spaces_within_brackets = false
|
|
||||||
ij_json_wrap_long_lines = false
|
|
||||||
|
|
||||||
[{*.htm,*.html,*.sht,*.shtm,*.shtml}]
|
|
||||||
indent_style = tab
|
|
||||||
ij_smart_tabs = true
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3
|
|
||||||
ij_html_align_attributes = true
|
|
||||||
ij_html_align_text = false
|
|
||||||
ij_html_attribute_wrap = normal
|
|
||||||
ij_html_block_comment_at_first_column = true
|
|
||||||
ij_html_do_not_align_children_of_min_lines = 0
|
|
||||||
ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p
|
|
||||||
ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot,style,script,head
|
|
||||||
ij_html_enforce_quotes = false
|
|
||||||
ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var
|
|
||||||
ij_html_keep_blank_lines = 2
|
|
||||||
ij_html_keep_indents_on_empty_lines = false
|
|
||||||
ij_html_keep_line_breaks = true
|
|
||||||
ij_html_keep_line_breaks_in_text = true
|
|
||||||
ij_html_keep_whitespaces = false
|
|
||||||
ij_html_keep_whitespaces_inside = span,pre,textarea
|
|
||||||
ij_html_line_comment_at_first_column = true
|
|
||||||
ij_html_new_line_after_last_attribute = never
|
|
||||||
ij_html_new_line_before_first_attribute = never
|
|
||||||
ij_html_quote_style = none
|
|
||||||
ij_html_remove_new_line_before_tags = br
|
|
||||||
ij_html_space_after_tag_name = false
|
|
||||||
ij_html_space_around_equality_in_attribute = false
|
|
||||||
ij_html_space_inside_empty_tag = false
|
|
||||||
ij_html_text_wrap = normal
|
|
||||||
|
|
||||||
[{*.markdown,*.md}]
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_markdown_force_one_space_after_blockquote_symbol = true
|
|
||||||
ij_markdown_force_one_space_after_header_symbol = true
|
|
||||||
ij_markdown_force_one_space_after_list_bullet = true
|
|
||||||
ij_markdown_force_one_space_between_words = true
|
|
||||||
ij_markdown_keep_indents_on_empty_lines = false
|
|
||||||
ij_markdown_max_lines_around_block_elements = 1
|
|
||||||
ij_markdown_max_lines_around_header = 1
|
|
||||||
ij_markdown_max_lines_between_paragraphs = 1
|
|
||||||
ij_markdown_min_lines_around_block_elements = 1
|
|
||||||
ij_markdown_min_lines_around_header = 1
|
|
||||||
ij_markdown_min_lines_between_paragraphs = 1
|
|
||||||
|
|
||||||
[{*.yaml,*.yml}]
|
|
||||||
indent_size = 2
|
|
||||||
ij_visual_guides = none
|
|
||||||
ij_yaml_align_values_properties = do_not_align
|
|
||||||
ij_yaml_autoinsert_sequence_marker = true
|
|
||||||
ij_yaml_block_mapping_on_new_line = false
|
|
||||||
ij_yaml_indent_sequence_value = true
|
|
||||||
ij_yaml_keep_indents_on_empty_lines = false
|
|
||||||
ij_yaml_keep_line_breaks = true
|
|
||||||
ij_yaml_sequence_on_new_line = false
|
|
||||||
ij_yaml_space_before_colon = false
|
|
||||||
ij_yaml_spaces_within_braces = true
|
|
||||||
ij_yaml_spaces_within_brackets = true
|
|
||||||
48
.gitattributes
vendored
48
.gitattributes
vendored
@@ -1,48 +0,0 @@
|
|||||||
# Set the default behavior, in case people don't have core.autocrlf set.
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
# Explicitly declare text files you want to always be normalized and converted
|
|
||||||
# to native line endings on checkout.
|
|
||||||
*.bash text eol=lf
|
|
||||||
*.bat text eol=lf
|
|
||||||
*.cmd text eol=lf
|
|
||||||
*.css text eol=lf
|
|
||||||
*.scss text eol=lf
|
|
||||||
*.dist text eol=lf
|
|
||||||
.editorconfig text eol=lf
|
|
||||||
.env* text eol=lf
|
|
||||||
.gitignore text eol=lf
|
|
||||||
.htaccess text eol=lf
|
|
||||||
*.htm text eol=lf
|
|
||||||
*.html text eol=lf
|
|
||||||
*.ini text eol=lf
|
|
||||||
*.js text eol=lf
|
|
||||||
*.json text eol=lf
|
|
||||||
*.lock text eol=lf
|
|
||||||
*.md text eol=lf
|
|
||||||
*.php text eol=lf
|
|
||||||
*.php_cs text eol=lf
|
|
||||||
*.php8 text eol=lf
|
|
||||||
*.plex text eol=lf
|
|
||||||
*.sh text eol=lf
|
|
||||||
*.svg text eol=lf
|
|
||||||
*.ts text eol=lf
|
|
||||||
*.twig text eol=lf
|
|
||||||
*.txt text eol=lf
|
|
||||||
*.xml text eol=lf
|
|
||||||
*.xsd text eol=lf
|
|
||||||
*.yaml text eol=lf
|
|
||||||
*.yml text eol=lf
|
|
||||||
|
|
||||||
# Denote all files that are truly binary and should not be modified.
|
|
||||||
*.png binary
|
|
||||||
*.jpeg binary
|
|
||||||
*.jpg binary
|
|
||||||
*.gif binary
|
|
||||||
*.ico binary
|
|
||||||
*.pdf binary
|
|
||||||
*.swf binary
|
|
||||||
*.zip binary
|
|
||||||
*.ttf binary
|
|
||||||
*.woff binary
|
|
||||||
*.woff2 binary
|
|
||||||
83
.github/pull_request_template.md
vendored
83
.github/pull_request_template.md
vendored
@@ -1,83 +0,0 @@
|
|||||||
<!--
|
|
||||||
|
|
||||||
IMPORTANT: Please follow the guidelines within this PR template before submitting it, it will greatly help us process your PR. 🙏
|
|
||||||
|
|
||||||
Any PRs not following the guidelines or with missing information will not be considered.
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
## Base information
|
|
||||||
| Question | Answer
|
|
||||||
|---------------------------------------------------------------|--------
|
|
||||||
| Related to a SourceForge thead / Another PR / Combodo ticket? | <!-- Put the URL -->
|
|
||||||
| Type of change? | Bug fix / Enhancement / Translations
|
|
||||||
|
|
||||||
|
|
||||||
## Symptom (bug) / Objective (enhancement)
|
|
||||||
<!--
|
|
||||||
If it's a bug
|
|
||||||
- Explain the symptom in details
|
|
||||||
- If possible put error messages, logs or screenshots (you can paste image directly in this editor).
|
|
||||||
|
|
||||||
If it's an enhancement
|
|
||||||
- Describe what is blocking you, what is the objective with as much details as possible.
|
|
||||||
- Add screenshots if it's related to UI.
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
## Reproduction procedure (bug)
|
|
||||||
<!--
|
|
||||||
Remove this section only if it's NOT a bug.
|
|
||||||
|
|
||||||
Otherwise, explain step by step how to reproduce the issue on a standard iTop Community.
|
|
||||||
|
|
||||||
If it requires a custom datamodel, provide the minimal XML delta to reproduce it on a standard iTop Community.
|
|
||||||
-->
|
|
||||||
|
|
||||||
1. On iTop x.y.z <!-- Put complete iTop version (eg. 3.1.0-2) -->
|
|
||||||
2. With PHP x.y.z <!-- Put complete PHP version (eg. 8.1.24) -->
|
|
||||||
2. First go there
|
|
||||||
2. Then do that
|
|
||||||
3. ...
|
|
||||||
4. Finally, see that...
|
|
||||||
|
|
||||||
|
|
||||||
## Cause (bug)
|
|
||||||
<!--
|
|
||||||
Remove this section only if it's NOT a bug.
|
|
||||||
|
|
||||||
Otherwise, explain what is the cause of the issue (where in the code and why)
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
## Proposed solution (bug and enhancement)
|
|
||||||
<!--
|
|
||||||
Explain in details how you are proposing to solve this:
|
|
||||||
- What did you do in the code and why
|
|
||||||
- If you changed something in the UI, put before / after screenshots (you can paste image directly in this editor)
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
## Checklist before requesting a review
|
|
||||||
<!--
|
|
||||||
Don't remove these lines, check them once done.
|
|
||||||
-->
|
|
||||||
- [ ] I have performed a self-review of my code
|
|
||||||
- [ ] I have tested all changes I made on an iTop instance
|
|
||||||
- [ ] I have added a unit test, otherwise I have explained why I couldn't
|
|
||||||
- [ ] Is the PR clear and detailed enough so anyone can understand digging in the code?
|
|
||||||
|
|
||||||
## Checklist of things to do before PR is ready to merge
|
|
||||||
<!--
|
|
||||||
Things that needs to be done in the PR before it can be considered as ready to be merged
|
|
||||||
|
|
||||||
Examples:
|
|
||||||
- Changes requested in the review
|
|
||||||
- Unit test to add
|
|
||||||
- Dictionary entries to translate
|
|
||||||
- ...
|
|
||||||
-->
|
|
||||||
|
|
||||||
- [ ] ...
|
|
||||||
- [ ] ...
|
|
||||||
- [ ] ...
|
|
||||||
43
.github/workflows/action.yml
vendored
43
.github/workflows/action.yml
vendored
@@ -1,43 +0,0 @@
|
|||||||
name: Add PRs to Combodo PRs Dashboard
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
add-to-project:
|
|
||||||
name: Add PR to Combodo Project
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check if author is a member of the organization
|
|
||||||
id: check-membership
|
|
||||||
run: |
|
|
||||||
ORG="Combodo"
|
|
||||||
AUTHOR=$(jq -r .pull_request.user.login "$GITHUB_EVENT_PATH")
|
|
||||||
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \
|
|
||||||
"https://api.github.com/orgs/$ORG/members/$AUTHOR")
|
|
||||||
if [ "$RESPONSE" == "404" ]; then
|
|
||||||
echo "project_url=https://github.com/orgs/Combodo/projects/5" >> $GITHUB_ENV
|
|
||||||
echo "is_member=false" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "project_url=https://github.com/orgs/Combodo/projects/4" >> $GITHUB_ENV
|
|
||||||
echo "is_member=true" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Add internal tag if member
|
|
||||||
if: env.is_member == 'true'
|
|
||||||
run: |
|
|
||||||
curl -X POST -H "Authorization: token ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}" \
|
|
||||||
-H "Accept: application/vnd.github.v3+json" \
|
|
||||||
https://api.github.com/repos/Combodo/iTop/issues/${{ github.event.pull_request.number }}/labels \
|
|
||||||
-d '{"labels":["internal"]}'
|
|
||||||
env:
|
|
||||||
is_member: ${{ env.is_member }}
|
|
||||||
|
|
||||||
- name: Add PR to the appropriate project
|
|
||||||
uses: actions/add-to-project@v1.0.2
|
|
||||||
with:
|
|
||||||
project-url: ${{ env.project_url }}
|
|
||||||
github-token: ${{ secrets.PR_AUTOMATICALLY_ADD_TO_PROJECT }}
|
|
||||||
165
.gitignore
vendored
165
.gitignore
vendored
@@ -1,165 +0,0 @@
|
|||||||
|
|
||||||
################################### Temporary ignore rules during 2.8 UI/UX dev - START
|
|
||||||
/css/backoffice/main.css
|
|
||||||
|
|
||||||
# Sass converter
|
|
||||||
/**/.sass-cache/
|
|
||||||
################################### Temporary ignore rules during 2.8 UI/UX dev - END
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# no slash at the end to handle also symlinks
|
|
||||||
/toolkit
|
|
||||||
/env-*
|
|
||||||
|
|
||||||
# maintenance mode (N°2240)
|
|
||||||
/.maintenance
|
|
||||||
|
|
||||||
# composer reserver directory, from sources, populate/update using "composer install"
|
|
||||||
vendor/*
|
|
||||||
tests/*/vendor/*
|
|
||||||
|
|
||||||
# all conf but listing prevention
|
|
||||||
/conf/**
|
|
||||||
!/conf/.htaccess
|
|
||||||
!/conf/index.php
|
|
||||||
!/conf/web.config
|
|
||||||
|
|
||||||
# all datas but listing prevention
|
|
||||||
/data/**
|
|
||||||
!/data/.htaccess
|
|
||||||
!/data/index.php
|
|
||||||
!/data/web.config
|
|
||||||
!/data/exclude.txt
|
|
||||||
!/data/.compilation-symlinks
|
|
||||||
|
|
||||||
# iTop extensions
|
|
||||||
/extensions/**
|
|
||||||
!/extensions/.htaccess
|
|
||||||
!/extensions/readme.txt
|
|
||||||
!/extensions/web.config
|
|
||||||
|
|
||||||
# all logs but listing prevention
|
|
||||||
/log/**
|
|
||||||
!/log/.htaccess
|
|
||||||
!/log/index.php
|
|
||||||
!/log/web.config
|
|
||||||
|
|
||||||
# NPM: `jquery-ui` package is just there for vulnerability scans, so we don't want to version its files (only `jquery-ui-dist` is used within the code base)
|
|
||||||
/node_modules/jquery-ui/**
|
|
||||||
|
|
||||||
# Symfony: Local env file
|
|
||||||
/resources/symfony/.env.local
|
|
||||||
|
|
||||||
# PHPUnit: Cache file, local XML working copies
|
|
||||||
/tests/php-unit-tests/.phpunit.result.cache
|
|
||||||
/tests/php-unit-tests/phpunit.xml
|
|
||||||
/tests/php-unit-tests/postbuild_integration.xml
|
|
||||||
|
|
||||||
|
|
||||||
# Jetbrains
|
|
||||||
/.idea/**
|
|
||||||
!/.idea/IntelliLang.xml
|
|
||||||
|
|
||||||
# doc. generation
|
|
||||||
/.doc/vendor
|
|
||||||
|
|
||||||
|
|
||||||
#phpdocumentor temp file
|
|
||||||
ast.dump
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
cmake-build-*/
|
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
# File-based project format
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
out/
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
|
|
||||||
# Editor-based Rest Client
|
|
||||||
.idea/httpRequests
|
|
||||||
### Eclipse template
|
|
||||||
|
|
||||||
.metadata
|
|
||||||
tmp/
|
|
||||||
*.tmp
|
|
||||||
*.bak
|
|
||||||
*.swp
|
|
||||||
*~.nib
|
|
||||||
local.properties
|
|
||||||
.settings/
|
|
||||||
.loadpath
|
|
||||||
.recommenders
|
|
||||||
.project
|
|
||||||
|
|
||||||
# External tool builders
|
|
||||||
.externalToolBuilders/
|
|
||||||
|
|
||||||
# Locally stored "Eclipse launch configurations"
|
|
||||||
*.launch
|
|
||||||
|
|
||||||
# PyDev specific (Python IDE for Eclipse)
|
|
||||||
*.pydevproject
|
|
||||||
|
|
||||||
# CDT-specific (C/C++ Development Tooling)
|
|
||||||
.cproject
|
|
||||||
|
|
||||||
# CDT- autotools
|
|
||||||
.autotools
|
|
||||||
|
|
||||||
# Java annotation processor (APT)
|
|
||||||
.factorypath
|
|
||||||
|
|
||||||
# PDT-specific (PHP Development Tools)
|
|
||||||
.buildpath
|
|
||||||
|
|
||||||
# sbteclipse plugin
|
|
||||||
.target
|
|
||||||
|
|
||||||
# Tern plugin
|
|
||||||
.tern-project
|
|
||||||
|
|
||||||
# TeXlipse plugin
|
|
||||||
.texlipse
|
|
||||||
|
|
||||||
# STS (Spring Tool Suite)
|
|
||||||
.springBeans
|
|
||||||
|
|
||||||
# Code Recommenders
|
|
||||||
.recommenders/
|
|
||||||
|
|
||||||
# Annotation Processing
|
|
||||||
.apt_generated/
|
|
||||||
|
|
||||||
# Scala IDE specific (Scala & Java development for Eclipse)
|
|
||||||
.cache-main
|
|
||||||
.scala_dependencies
|
|
||||||
.worksheet
|
|
||||||
|
|
||||||
# Mac
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
# Windows
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
15
.idea/IntelliLang.xml
generated
15
.idea/IntelliLang.xml
generated
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="LanguageInjectionConfiguration">
|
|
||||||
<injection language="InjectablePHP" injector-id="xml">
|
|
||||||
<display-name>iTop - Class method code</display-name>
|
|
||||||
<place><![CDATA[xmlTag().withLocalName(string().equalTo("code"))]]></place>
|
|
||||||
<xpath-condition>name(..) = 'method' and count(/itop_design) = 1</xpath-condition>
|
|
||||||
</injection>
|
|
||||||
<injection language="InjectablePHP" injector-id="xml">
|
|
||||||
<display-name>iTop - Snippet code</display-name>
|
|
||||||
<place><![CDATA[xmlTag().withLocalName(string().equalTo("snippet"))]]></place>
|
|
||||||
<xpath-condition>name(..) = 'snippets' and count(/itop_design) = 1</xpath-condition>
|
|
||||||
</injection>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
= Make Doc =
|
|
||||||
.make folder is meant to gather tools for releasing process. Maybe other new purposes will come as well....
|
|
||||||
|
|
||||||
== license ==
|
|
||||||
- updateLicenses.php: used to update community-licenses.xml easily based on composer.json files
|
|
||||||
- sortLicenceXml.php: used to sort licenses based on scope + product name
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
<?php
|
|
||||||
$iBeginTime = time();
|
|
||||||
|
|
||||||
chdir(__DIR__);
|
|
||||||
|
|
||||||
$aCommands = [
|
|
||||||
'php composer/rmUnnecessaryFolders.php',
|
|
||||||
'php build/commands/setupCssCompiler.php',
|
|
||||||
// 'bash /tmp/gabuzomeu.sh',
|
|
||||||
];
|
|
||||||
|
|
||||||
$aFailedCommands=[];
|
|
||||||
foreach ($aCommands as $sCommand)
|
|
||||||
{
|
|
||||||
if (!ExecCommand($sCommand))
|
|
||||||
{
|
|
||||||
$aFailedCommands[] = $sCommand;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$iElapsed = time() - $iBeginTime;
|
|
||||||
|
|
||||||
if (count($aFailedCommands))
|
|
||||||
{
|
|
||||||
fwrite(STDERR, "\nafterBuild execution failed! (in {$iElapsed}s)\n");
|
|
||||||
fwrite(STDERR, "List of failling commands:\n - " . implode("\n - ", $aFailedCommands) . "\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
echo "\nDone ({$iElapsed}s)\n";
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Executes a command and returns an array with exit code, stdout and stderr content
|
|
||||||
*
|
|
||||||
* @param string $cmd - Command to execute
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
function ExecCommand($cmd) {
|
|
||||||
$iBeginTime = time();
|
|
||||||
|
|
||||||
|
|
||||||
echo sprintf("command: %s", str_pad("$cmd ", 50));
|
|
||||||
|
|
||||||
$descriptorspec = array(
|
|
||||||
0 => array("pipe", "r"), // stdin
|
|
||||||
1 => array("pipe", "w"), // stdout
|
|
||||||
2 => array("pipe", "w"), // stderr
|
|
||||||
);
|
|
||||||
$process = proc_open($cmd, $descriptorspec, $pipes, __DIR__ . '/..', null);
|
|
||||||
|
|
||||||
$stdout = stream_get_contents($pipes[1]);
|
|
||||||
fclose($pipes[1]);
|
|
||||||
|
|
||||||
$stderr = stream_get_contents($pipes[2]);
|
|
||||||
fclose($pipes[2]);
|
|
||||||
|
|
||||||
$iCode = proc_close($process);
|
|
||||||
$bSuccess = (0 === $iCode);
|
|
||||||
|
|
||||||
$iElapsed = time() - $iBeginTime;
|
|
||||||
if (!$bSuccess) {
|
|
||||||
fwrite(STDERR, sprintf(
|
|
||||||
"\nCOMMAND FAILED! (%s) \n - status:%s \n - stderr:%s \n - stdout: %s\n - elapsed:%ss\n\n",
|
|
||||||
$cmd,
|
|
||||||
$iCode,
|
|
||||||
rtrim($stderr),
|
|
||||||
rtrim($stdout),
|
|
||||||
$iElapsed
|
|
||||||
));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo "| elapsed:{$iElapsed}s \n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($stderr))
|
|
||||||
{
|
|
||||||
fwrite(STDERR, "$stderr\n");
|
|
||||||
}
|
|
||||||
if (!empty($stdout))
|
|
||||||
{
|
|
||||||
echo "stdout :$stdout\n\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $bSuccess;
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*
|
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Combodo\iTop\Composer\iTopComposer;
|
|
||||||
|
|
||||||
$iTopFolder = __DIR__."/../../../";
|
|
||||||
|
|
||||||
require_once("$iTopFolder/approot.inc.php");
|
|
||||||
require_once(APPROOT."/application/utils.inc.php");
|
|
||||||
|
|
||||||
if (PHP_SAPI !== 'cli')
|
|
||||||
{
|
|
||||||
throw new \Exception('This script can only run from CLI');
|
|
||||||
}
|
|
||||||
|
|
||||||
$sCssFile = APPROOT.'/css/setup.css';
|
|
||||||
if (file_exists($sCssFile))
|
|
||||||
{
|
|
||||||
fwrite(STDERR, "$sCssFile already exists (it should not), removing it.");
|
|
||||||
if (!unlink($sCssFile))
|
|
||||||
{
|
|
||||||
fwrite(STDERR, "Failed to remove $sCssFile, exiting.");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sCssRelPath = utils::GetCSSFromSASS('css/setup.scss');
|
|
||||||
|
|
||||||
if (!file_exists($sCssFile))
|
|
||||||
{
|
|
||||||
fwrite(STDERR, "Failed to compile $sCssFile, exiting.");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*
|
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Alias for `composer show -loD`
|
|
||||||
* You can also use `composer outdated -D`
|
|
||||||
*
|
|
||||||
* @link https://getcomposer.org/doc/03-cli.md#show
|
|
||||||
*/
|
|
||||||
|
|
||||||
$iTopFolder = __DIR__."/../../../";
|
|
||||||
|
|
||||||
require_once("$iTopFolder/approot.inc.php");
|
|
||||||
$sApproot = APPROOT;
|
|
||||||
$aTrace = array();
|
|
||||||
|
|
||||||
$aParamsConfig = array(
|
|
||||||
'composer-path' => array(
|
|
||||||
'default' => 'composer',
|
|
||||||
),
|
|
||||||
);
|
|
||||||
$aParamsConfigNotFound = array_flip(array_keys($aParamsConfig));
|
|
||||||
$aGivenArgs = $argv;
|
|
||||||
unset($aGivenArgs[0]);
|
|
||||||
|
|
||||||
$aParams = array();
|
|
||||||
|
|
||||||
foreach ($aParamsConfig as $sParam => $aConfig)
|
|
||||||
{
|
|
||||||
$bParamsFound = false;
|
|
||||||
foreach ($aGivenArgs as $sGivenArg)
|
|
||||||
{
|
|
||||||
if (preg_match("/--$sParam(?:=(?<value>.*))?$/", $sGivenArg, $aMatches))
|
|
||||||
{
|
|
||||||
$aParams[$sParam] =
|
|
||||||
isset($aMatches['value'])
|
|
||||||
? $aMatches['value']
|
|
||||||
: true
|
|
||||||
;
|
|
||||||
$bParamsFound = true;
|
|
||||||
unset($aGivenArgs[$sGivenArg]);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($bParamsFound)
|
|
||||||
{
|
|
||||||
unset($aParamsConfigNotFound[$sParam]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($aParamsConfigNotFound as $sParamsConfigNotFound => $void)
|
|
||||||
{
|
|
||||||
if (isset($aParamsConfig[$sParamsConfigNotFound]['default']))
|
|
||||||
{
|
|
||||||
$aParams[$sParamsConfigNotFound] = $aParamsConfig[$sParamsConfigNotFound]['default'];
|
|
||||||
$aTrace[] = "\e[1;30mUsing default value '{$aParams[$sParamsConfigNotFound]}' for '$sParamsConfigNotFound'\e[0m\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
die("Missing '$sParamsConfigNotFound'");
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "This command aims at helping you find upgradable dependencies\n";
|
|
||||||
echo "\e[0;33mBeware of the version colored in orange, they probably introduce BC breaks!\e[0m\n";
|
|
||||||
|
|
||||||
$sCommand = "{$aParams['composer-path']} show -loD --working-dir=$sApproot --ansi";
|
|
||||||
$execCode = exec($sCommand, $output);
|
|
||||||
$sOutput = implode("\n", $output)."\n";
|
|
||||||
|
|
||||||
if (!$execCode)
|
|
||||||
{
|
|
||||||
echo "\e[41mFailed to execute '$sCommand'\e[0m\n";
|
|
||||||
echo "Trace: \n".implode("\n", $aTrace);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$iCountDepdendenciesFound = count($output);
|
|
||||||
|
|
||||||
$iCountBc = substr_count($sOutput, '[33m');
|
|
||||||
|
|
||||||
echo sprintf("Found \033[44m%d\033[0m upgradable dependencies, including \e[41m%s BC break\e[0m 😱 :\n\n", $iCountDepdendenciesFound, $iCountBc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
echo $sOutput;
|
|
||||||
|
|
||||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -1,56 +0,0 @@
|
|||||||
courier.php
|
|
||||||
courierb.php
|
|
||||||
courierbi.php
|
|
||||||
courieri.php
|
|
||||||
dejavusans.ctg.z
|
|
||||||
dejavusans.php
|
|
||||||
dejavusans.z
|
|
||||||
dejavusansb.ctg.z
|
|
||||||
dejavusansb.php
|
|
||||||
dejavusansb.z
|
|
||||||
dejavusansbi.ctg.z
|
|
||||||
dejavusansbi.php
|
|
||||||
dejavusansbi.z
|
|
||||||
dejavusanscondensed.ctg.z
|
|
||||||
dejavusanscondensed.php
|
|
||||||
dejavusanscondensed.z
|
|
||||||
dejavusanscondensedb.ctg.z
|
|
||||||
dejavusanscondensedb.php
|
|
||||||
dejavusanscondensedb.z
|
|
||||||
dejavusanscondensedbi.ctg.z
|
|
||||||
dejavusanscondensedbi.php
|
|
||||||
dejavusanscondensedbi.z
|
|
||||||
dejavusanscondensedi.ctg.z
|
|
||||||
dejavusanscondensedi.php
|
|
||||||
dejavusanscondensedi.z
|
|
||||||
dejavusansextralight.ctg.z
|
|
||||||
dejavusansextralight.php
|
|
||||||
dejavusansextralight.z
|
|
||||||
dejavusansi.ctg.z
|
|
||||||
dejavusansi.php
|
|
||||||
dejavusansi.z
|
|
||||||
dejavusansmono.ctg.z
|
|
||||||
dejavusansmono.php
|
|
||||||
dejavusansmono.z
|
|
||||||
dejavusansmonob.ctg.z
|
|
||||||
dejavusansmonob.php
|
|
||||||
dejavusansmonob.z
|
|
||||||
dejavusansmonobi.ctg.z
|
|
||||||
dejavusansmonobi.php
|
|
||||||
dejavusansmonobi.z
|
|
||||||
dejavusansmonoi.ctg.z
|
|
||||||
dejavusansmonoi.php
|
|
||||||
dejavusansmonoi.z
|
|
||||||
droidsansfallback.ctg.z
|
|
||||||
droidsansfallback.php
|
|
||||||
droidsansfallback.z
|
|
||||||
helvetica.php
|
|
||||||
helveticab.php
|
|
||||||
helveticabi.php
|
|
||||||
helveticai.php
|
|
||||||
symbol.php
|
|
||||||
times.php
|
|
||||||
timesb.php
|
|
||||||
timesbi.php
|
|
||||||
timesi.php
|
|
||||||
zapfdingbats.php
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* This script will copy custom fonts in the TCPDF lib fonts directory.
|
|
||||||
* If you need to add other files :
|
|
||||||
* - add the corresponding files in this script directory
|
|
||||||
* - modify this script to copy also your files
|
|
||||||
*
|
|
||||||
* @since 2.7.0 N°1947 add DroidSansFallback font (see also PR #49 in the links below)
|
|
||||||
* @since 2.7.0 N°2435 TCPPDF lib forked and added in composer.json (at that time the lib was announced as deprecated and rewritten in tecnickcom/tc-lib-pdf)
|
|
||||||
* @since 3.2.0 N°7175 switch back to TCPDF original lib (which is finally still maintained, tecnickcom/tc-lib-pdf us still under dev), script creation to keep custom DroidSansFallback font
|
|
||||||
*
|
|
||||||
* @link https://github.com/Combodo/iTop/pull/49 add DroidSansFallback font
|
|
||||||
* @link https://github.com/tecnickcom/TCPDF?tab=readme-ov-file#note TCPDF is in support only mode
|
|
||||||
*/
|
|
||||||
|
|
||||||
$sItopRootFolder = realpath(__DIR__ . "/../../../../");
|
|
||||||
$sCurrentScriptFileName = basename(__FILE__);
|
|
||||||
|
|
||||||
|
|
||||||
require_once ("$sItopRootFolder/lib/autoload.php");
|
|
||||||
|
|
||||||
|
|
||||||
$sTcPdfRootFolder = $sItopRootFolder.'/lib/tecnickcom/tcpdf';
|
|
||||||
if (false === file_exists($sTcPdfRootFolder)) {
|
|
||||||
echo $sCurrentScriptFileName.": No TCPDF lib detected, exiting !\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$sTcPdfFontsFolder = $sTcPdfRootFolder.'/Fonts/';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 1) Cleaning up the fonts directory to keep only the ones we want in iTop
|
|
||||||
*/
|
|
||||||
echo $sCurrentScriptFileName.": ---1) Cleaning up the fonts files\n";
|
|
||||||
$aTcpdfDefaultFontsToKeepInItop = file(__DIR__.'/tcpdfDefaultFontsToKeepInItop.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
|
||||||
|
|
||||||
$aTcpdfFontsDirContent = scandir($sTcPdfFontsFolder);
|
|
||||||
foreach ($aTcpdfFontsDirContent as $sTcpdfFontResourceName) {
|
|
||||||
if ($sTcpdfFontResourceName === '.') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($sTcpdfFontResourceName === '..') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array($sTcpdfFontResourceName, $aTcpdfDefaultFontsToKeepInItop, true)) {
|
|
||||||
echo $sCurrentScriptFileName.": Removing $sTcpdfFontResourceName !\n";
|
|
||||||
|
|
||||||
$sTcpdfFontResourceFullPath = $sTcPdfFontsFolder.$sTcpdfFontResourceName;
|
|
||||||
if (is_file($sTcpdfFontResourceFullPath)) {
|
|
||||||
unlink($sTcpdfFontResourceFullPath);
|
|
||||||
} elseif (is_dir($sTcpdfFontResourceFullPath)) {
|
|
||||||
rrmdir($sTcpdfFontResourceFullPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 2) Then adding the DroidSansFallback font (useful for CJK data for example)
|
|
||||||
*/
|
|
||||||
echo $sCurrentScriptFileName.": ---2) Copying font files to TCPDF ($sTcPdfFontsFolder)...\n";
|
|
||||||
$aFontFilesToCopy = glob(__DIR__.'\droidsansfallback.*');
|
|
||||||
foreach ($aFontFilesToCopy as $sFontFileToCopy) {
|
|
||||||
$sFontFileName = basename($sFontFileToCopy);
|
|
||||||
echo $sCurrentScriptFileName.': copying '.$sFontFileName."\n";
|
|
||||||
copy($sFontFileToCopy, $sTcPdfFontsFolder.$sFontFileName);
|
|
||||||
}
|
|
||||||
echo $sCurrentScriptFileName.": Done !\n";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recursively delete a directory and its content
|
|
||||||
*
|
|
||||||
* @param $sDirToRemovePath
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function rrmdir($sDirToRemovePath):void
|
|
||||||
{
|
|
||||||
if (is_dir($sDirToRemovePath)) {
|
|
||||||
$objects = scandir($sDirToRemovePath);
|
|
||||||
foreach ($objects as $object) {
|
|
||||||
if ($object != "." && $object != "..") {
|
|
||||||
if (filetype($sDirToRemovePath."/".$object) == "dir") {
|
|
||||||
rrmdir($sDirToRemovePath."/".$object);
|
|
||||||
} else {
|
|
||||||
unlink($sDirToRemovePath."/".$object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reset($objects);
|
|
||||||
rmdir($sDirToRemovePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*
|
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ensure that the files for folder browsing protection (.htaccess, web.config) are kept after an "npm install/update" command
|
|
||||||
*/
|
|
||||||
|
|
||||||
$iTopFolder = __DIR__."/../../../";
|
|
||||||
|
|
||||||
require_once("$iTopFolder/approot.inc.php");
|
|
||||||
|
|
||||||
$sDependenciesRootFolderAbsPath = APPROOT . "node_modules/";
|
|
||||||
$aFilesToCheck = [
|
|
||||||
".htaccess",
|
|
||||||
"web.config",
|
|
||||||
];
|
|
||||||
|
|
||||||
echo "This command aims at ensuring that folder browsing protection files (.htaccess, web.config) are present in the dependencies folder even after an install/upgrade command\n";
|
|
||||||
echo "Checking files:\n";
|
|
||||||
|
|
||||||
foreach($aFilesToCheck as $sFileToCheck) {
|
|
||||||
if (file_exists($sDependenciesRootFolderAbsPath . $sFileToCheck)) {
|
|
||||||
echo "✔️ $sFileToCheck is present\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If missing, copy the one from /lib as it contains the necessary allow/deny directives for third-parties
|
|
||||||
copy(APPROOT . "lib/$sFileToCheck", $sDependenciesRootFolderAbsPath . $sFileToCheck);
|
|
||||||
echo "✔️ $sFileToCheck was missing and has been re-created\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure separation with following scripts
|
|
||||||
echo "\n";
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*
|
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$iTopFolder = __DIR__ . "/../../" ;
|
|
||||||
|
|
||||||
require_once ("$iTopFolder/approot.inc.php");
|
|
||||||
require_once (APPROOT."/setup/setuputils.class.inc.php");
|
|
||||||
|
|
||||||
if (php_sapi_name() !== 'cli')
|
|
||||||
{
|
|
||||||
throw new \Exception('This script can only run from CLI');
|
|
||||||
}
|
|
||||||
|
|
||||||
clearstatcache();
|
|
||||||
|
|
||||||
// Read params
|
|
||||||
$key = array_search("--manager", $argv);
|
|
||||||
if (false === $key || false === isset($argv[$key + 1]) ) {
|
|
||||||
throw new \InvalidArgumentException("Usage: " . __FILE__ . " --manager composer|npm");
|
|
||||||
}
|
|
||||||
$sDependenciesHandlerCode = $argv[$key + 1];
|
|
||||||
|
|
||||||
switch ($sDependenciesHandlerCode) {
|
|
||||||
case "composer":
|
|
||||||
$sDependenciesHandlerFQCN = \Combodo\iTop\Dependencies\Composer\iTopComposer::class;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "npm":
|
|
||||||
$sDependenciesHandlerFQCN = \Combodo\iTop\Dependencies\NPM\iTopNPM::class;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new \Exception("Invalid dependencies handler code, $sDependenciesHandlerCode given, expected composer|npm");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start handler
|
|
||||||
$oDependenciesHandler = new $sDependenciesHandlerFQCN();
|
|
||||||
$aDeniedButStillPresent = $oDependenciesHandler->ListDeniedButStillPresentFilesAbsPaths();
|
|
||||||
|
|
||||||
echo "\n";
|
|
||||||
foreach ($aDeniedButStillPresent as $sDir)
|
|
||||||
{
|
|
||||||
if (false === $oDependenciesHandler::IsQuestionnableFile($sDir))
|
|
||||||
{
|
|
||||||
echo "ERROR found INVALID denied test dir: '$sDir'\n";
|
|
||||||
throw new \RuntimeException("$sDir is in the denied list but doesn't comply with the rule (see IsQuestionnableFolder method)");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (false === file_exists($sDir)) {
|
|
||||||
echo "INFO $sDir is in denied list, but not existing on disk => skipping !\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if(is_dir($sDir)){
|
|
||||||
SetupUtils::rrmdir($sDir);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
unlink($sDir);
|
|
||||||
}
|
|
||||||
echo "✔️ Remove denied test dir: '$sDir'\n";
|
|
||||||
}
|
|
||||||
catch (\Exception $e) {
|
|
||||||
echo "\n❌ FAILED to remove denied test dir: '$sDir'\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$aAllowedAndDeniedDirs = array_merge(
|
|
||||||
$oDependenciesHandler->ListAllowedFilesAbsPaths(),
|
|
||||||
$oDependenciesHandler->ListDeniedFilesAbsPaths()
|
|
||||||
);
|
|
||||||
$aExistingDirs = $oDependenciesHandler->ListAllFilesAbsPaths();
|
|
||||||
$aMissing = array_diff($aExistingDirs, $aAllowedAndDeniedDirs);
|
|
||||||
if (false === empty($aMissing)) {
|
|
||||||
echo "Some new tests dirs exists !\n"
|
|
||||||
." They must be declared either in the allowed or denied list in {$sDependenciesHandlerFQCN}\n"
|
|
||||||
.' List of dirs:'."\n".var_export($aMissing, true)."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure separation with following scripts
|
|
||||||
echo "\n";
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
# Git hooks for iTop
|
|
||||||
|
|
||||||
## ❓ Goal
|
|
||||||
|
|
||||||
Those [git hooks](https://git-scm.com/docs/githooks) aims to ease developing on [iTop](https://github.com/Combodo/iTop).
|
|
||||||
|
|
||||||
## ☑ Available hooks
|
|
||||||
|
|
||||||
* pre-commit : rejects commit if you have at least one SCSS file staged, and no CSS file
|
|
||||||
|
|
||||||
## ⚙ Install
|
|
||||||
|
|
||||||
Just run install.php !
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
$aHooks = [
|
|
||||||
'pre-commit.php',
|
|
||||||
];
|
|
||||||
|
|
||||||
$sAppRoot = dirname(__DIR__, 2);
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($aHooks as $sSourceHookFileName) {
|
|
||||||
echo "Processing for `{$sSourceHookFileName}`...\n";
|
|
||||||
$sSourceHookPath = __DIR__.DIRECTORY_SEPARATOR.$sSourceHookFileName;
|
|
||||||
|
|
||||||
$aPathParts = pathinfo($sSourceHookFileName);
|
|
||||||
$sTargetHookPath = $sAppRoot.DIRECTORY_SEPARATOR.'.git'.DIRECTORY_SEPARATOR.'hooks'.DIRECTORY_SEPARATOR.$aPathParts['filename'];
|
|
||||||
|
|
||||||
if (file_exists($sTargetHookPath) || is_link($sTargetHookPath)) {
|
|
||||||
echo "Existing $sTargetHookPath ! Removing...";
|
|
||||||
unlink($sTargetHookPath);
|
|
||||||
echo "OK !\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Creating symlink for hook in $sTargetHookPath...";
|
|
||||||
symlink($sSourceHookPath, $sTargetHookPath);
|
|
||||||
echo "OK !\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/usr/bin/php
|
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Reject any commit containing .scss files, but no .css file !
|
|
||||||
*/
|
|
||||||
|
|
||||||
echo "Checking files staged...\n";
|
|
||||||
$sFilesToCommit = shell_exec('git diff --cached --name-only --diff-filter=ACMRT');
|
|
||||||
$aFilesToCommit = explode("\n", $sFilesToCommit);
|
|
||||||
|
|
||||||
$aScssFiles = GetFilesWithExtension('scss', $aFilesToCommit);
|
|
||||||
if (count($aScssFiles) === 0) {
|
|
||||||
echo "No scss file : OK to go !\n";
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
$aCssFiles = GetFilesWithExtension('css', $aFilesToCommit);
|
|
||||||
if (count($aCssFiles) === 0) {
|
|
||||||
echo "There are SCSS files staged but no CSS file : REJECTING commit.\n";
|
|
||||||
echo "You must add the compiled SCSS files by running the setup !\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "We have SCSS but also CSS => OK to commit !\n";
|
|
||||||
exit(0);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function GetFilesWithExtension($sExtension, $aFiles) {
|
|
||||||
return array_filter(
|
|
||||||
$aFiles,
|
|
||||||
function($item) use ($sExtension) {
|
|
||||||
return (endsWith($item, '.'.$sExtension));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function endsWith( $haystack, $needle ) {
|
|
||||||
$length = strlen( $needle );
|
|
||||||
if( !$length ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return substr( $haystack, -$length ) === $needle;
|
|
||||||
}
|
|
||||||
|
|
||||||
function exitWithMessage($sMessage, $iCode) {
|
|
||||||
echo $sMessage;
|
|
||||||
exit($iCode);
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
#/bin/bash
|
|
||||||
|
|
||||||
#git diff --name-status 2.6.2..HEAD js |grep 'A\sjs/' |awk -F/ '{printf("lib/%s/%s\n",$2,$3)}'|sort |uniq >/tmp/toto
|
|
||||||
#git diff --name-status 2.6.2..HEAD lib |grep 'A\slib/' |awk -F/ '{printf("lib/%s/%s\n",$2,$3)}'|sort |uniq >/tmp/toto
|
|
||||||
|
|
||||||
function HELP(){
|
|
||||||
echo " Syntax: bash $0 /var/www/html/iTop"
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
|
||||||
then
|
|
||||||
echo "no iTop path provided"
|
|
||||||
HELP
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
iTopPath=$1
|
|
||||||
|
|
||||||
if [ ! -d $iTopPath ]
|
|
||||||
then
|
|
||||||
echo "$iTopPath is not an iTop path."
|
|
||||||
HELP
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "<?xml version=\"1.0\"?>
|
|
||||||
<licenses>"
|
|
||||||
|
|
||||||
for subfolder in lib datamodels
|
|
||||||
do
|
|
||||||
for l in $(find $iTopPath/$subfolder/ -name composer.json|sed 's|/composer.json||')
|
|
||||||
do
|
|
||||||
if [ ! -d $l ]
|
|
||||||
then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [ "$subfolder" == "datamodels" ]
|
|
||||||
then
|
|
||||||
if [ $(find $l -name module*.php|wc -l) -ne 0 -o $(echo "$l"|grep -c "itop-portal-base") -ne 0 ]
|
|
||||||
then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
dir=$(dirname $(dirname $l))
|
|
||||||
prod=$(echo $l| sed "s|$dir/||1")
|
|
||||||
echo $l $subfolder
|
|
||||||
lictype=$(cd $l && composer licenses --format json |jq .license[] |sed 's|\"||g')
|
|
||||||
|
|
||||||
authors=""
|
|
||||||
if [ -f $l/composer.json ]
|
|
||||||
then
|
|
||||||
author_nb=$(grep -c authors $l/composer.json|sed 's| ||g')
|
|
||||||
if [ "x$author_nb" != "x0" ]
|
|
||||||
then
|
|
||||||
OLDIFS=$IFS
|
|
||||||
IFS=$'\n'
|
|
||||||
for a in $(cat $l/composer.json |jq .authors[].name|sed 's|\"||g')
|
|
||||||
do
|
|
||||||
authors="$authors$a - "
|
|
||||||
done
|
|
||||||
authors="$authors#"
|
|
||||||
authors=$(echo $authors |sed 's| - #||')
|
|
||||||
IFS=$OLDIFS
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
lic=""
|
|
||||||
for licf in $(find $l -name LICEN*)
|
|
||||||
do
|
|
||||||
lic=$(cat $licf)
|
|
||||||
break
|
|
||||||
done
|
|
||||||
|
|
||||||
#if [ "x$lic" == "x" ]
|
|
||||||
#then
|
|
||||||
# echo "============== no license found $l"
|
|
||||||
#fi
|
|
||||||
|
|
||||||
echo " <license>
|
|
||||||
<product scope=\"$subfolder\">$prod</product>
|
|
||||||
<author>$authors</author>
|
|
||||||
<license_type>$lictype</license_type>
|
|
||||||
<text><![CDATA[
|
|
||||||
$lic
|
|
||||||
]]></text>
|
|
||||||
</license>"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "</licenses>"
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* script used to sort license file (usefull for autogeneration)
|
|
||||||
* Example:
|
|
||||||
*/
|
|
||||||
$iTopFolder = __DIR__ . "/../../" ;
|
|
||||||
$xmlFilePath = $iTopFolder . "setup/licenses/community-licenses.xml";
|
|
||||||
$dom = new DOMDocument();
|
|
||||||
$dom->load($xmlFilePath);
|
|
||||||
$xp = new DOMXPath($dom);
|
|
||||||
|
|
||||||
$licenseList = $xp->query('/licenses/license');
|
|
||||||
$licenses = iterator_to_array($licenseList);
|
|
||||||
|
|
||||||
|
|
||||||
function get_scope($product_node)
|
|
||||||
{
|
|
||||||
$scope = $product_node->getAttribute("scope");
|
|
||||||
|
|
||||||
if ($scope === "")
|
|
||||||
{ //put iTop first
|
|
||||||
return "aaaaaaaaa";
|
|
||||||
}
|
|
||||||
return $scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_product_node($license_node)
|
|
||||||
{
|
|
||||||
foreach ($license_node->childNodes as $child)
|
|
||||||
{
|
|
||||||
if (is_a($child, 'DomElement') && $child->tagName === "product")
|
|
||||||
{
|
|
||||||
return $child;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sort_by_product($a, $b)
|
|
||||||
{
|
|
||||||
$aProductNode = get_product_node($a);
|
|
||||||
$bProductNode = get_product_node($b);
|
|
||||||
|
|
||||||
$res = strcmp(get_scope($aProductNode), get_scope($bProductNode));
|
|
||||||
if ($res !== 0)
|
|
||||||
{
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
//sort on node product name
|
|
||||||
return strcmp($aProductNode->nodeValue, $bProductNode->nodeValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
usort($licenses, 'sort_by_product');
|
|
||||||
|
|
||||||
$newdom = new DOMDocument("1.0");
|
|
||||||
$newdom->formatOutput = true;
|
|
||||||
$root = $newdom->createElement("licenses");
|
|
||||||
$newdom->appendChild($root);
|
|
||||||
foreach ($licenses as $b) {
|
|
||||||
$node = $newdom->importNode($b,true);
|
|
||||||
$root->appendChild($newdom->importNode($b,true));
|
|
||||||
}
|
|
||||||
|
|
||||||
$newdom->save($xmlFilePath);
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* script used to sort license file (useful for autogeneration)
|
|
||||||
*
|
|
||||||
* Requirements :
|
|
||||||
* * bash (on Windows, use Git Bash)
|
|
||||||
* * composer (if you use the phar version, mind to create a `Composer` alias !)
|
|
||||||
* * JQ command
|
|
||||||
* to install on Windows :
|
|
||||||
* `curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe`
|
|
||||||
* this is a Windows port : https://stedolan.github.io/jq/
|
|
||||||
*
|
|
||||||
* Licenses sources :
|
|
||||||
* * `composer licenses --format json` (see https://getcomposer.org/doc/03-cli.md#licenses)
|
|
||||||
* * keep every existing nodes with `/licenses/license[11]/product/@scope` not in ['lib', 'datamodels']
|
|
||||||
* ⚠ If licenses were added manually, they might be removed by this tool ! Be very careful to check for the result before pushing !
|
|
||||||
*
|
|
||||||
* To launch, check requirements and run `php updateLicenses.php`
|
|
||||||
* The target license file path is in `$xmlFilePath`
|
|
||||||
*/
|
|
||||||
|
|
||||||
$iTopFolder = __DIR__."/../../";
|
|
||||||
$xmlFilePath = $iTopFolder."setup/licenses/community-licenses.xml";
|
|
||||||
|
|
||||||
$jqExec = shell_exec("jq -V"); // a param is mandatory otherwise the script will freeze
|
|
||||||
if ((null === $jqExec) || (false === $jqExec)) {
|
|
||||||
echo "/!\ JQ is required but cannot be launched :( \n";
|
|
||||||
echo "Check this script PHPDoc block for instructions\n";
|
|
||||||
die(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function get_scope($product_node) {
|
|
||||||
$scope = $product_node->getAttribute("scope");
|
|
||||||
|
|
||||||
if ($scope === "") { //put iTop first
|
|
||||||
return "aaaaaaaaa";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $scope;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_product_node($license_node)
|
|
||||||
{
|
|
||||||
foreach ($license_node->childNodes as $child)
|
|
||||||
{
|
|
||||||
if (is_a($child, 'DomElement') && $child->tagName === "product")
|
|
||||||
{
|
|
||||||
return $child;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sort_by_product($a, $b)
|
|
||||||
{
|
|
||||||
$aProductNode = get_product_node($a);
|
|
||||||
$bProductNode = get_product_node($b);
|
|
||||||
|
|
||||||
$res = strcmp(get_scope($aProductNode), get_scope($bProductNode));
|
|
||||||
if ($res !== 0)
|
|
||||||
{
|
|
||||||
return $res;
|
|
||||||
}
|
|
||||||
//sort on node product name
|
|
||||||
return strcmp($aProductNode->nodeValue, $bProductNode->nodeValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_license_nodes($file_path)
|
|
||||||
{
|
|
||||||
$dom = new DOMDocument();
|
|
||||||
$dom->load($file_path);
|
|
||||||
$xp = new DOMXPath($dom);
|
|
||||||
|
|
||||||
$licenseList = $xp->query('/licenses/license');
|
|
||||||
$licenses = iterator_to_array($licenseList);
|
|
||||||
|
|
||||||
usort($licenses, 'sort_by_product');
|
|
||||||
|
|
||||||
return $licenses;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @noinspection SuspiciousAssignmentsInspection */
|
|
||||||
function fix_product_name(DOMNode &$oProductNode)
|
|
||||||
{
|
|
||||||
$sProductNameOrig = $oProductNode->nodeValue;
|
|
||||||
|
|
||||||
// sample : `C:\Dev\wamp64\www\itop-27\.make\license/../..//lib/symfony/polyfill-ctype`
|
|
||||||
$sProductNameFixed = remove_dir_from_string($sProductNameOrig, 'lib/');
|
|
||||||
|
|
||||||
// sample : `C:\Dev\wamp64\www\itop-27\.make\license/../..//datamodels/2.x/authent-cas/vendor/apereo/phpcas`
|
|
||||||
$sProductNameFixed = remove_dir_from_string($sProductNameFixed, 'vendor/');
|
|
||||||
|
|
||||||
$oProductNode->nodeValue = $sProductNameFixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
function remove_dir_from_string($sString, $sNeedle)
|
|
||||||
{
|
|
||||||
if (strpos($sString, $sNeedle) === false) {
|
|
||||||
return $sString;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sStringTmp = strstr($sString, $sNeedle);
|
|
||||||
$sStringFixed = str_replace($sNeedle, '', $sStringTmp);
|
|
||||||
|
|
||||||
// DEBUG trace O:)
|
|
||||||
// echo "$sNeedle = $sString => $sStringFixed\n";
|
|
||||||
|
|
||||||
return $sStringFixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
$old_licenses = get_license_nodes($xmlFilePath);
|
|
||||||
|
|
||||||
//generate file with updated licenses
|
|
||||||
$generated_license_file_path = __DIR__."/provfile.xml";
|
|
||||||
echo "- Generating licences...";
|
|
||||||
exec("bash ".__DIR__."/gen-community-license.sh $iTopFolder > ".$generated_license_file_path);
|
|
||||||
echo "OK!\n";
|
|
||||||
|
|
||||||
echo "- Get licenses nodes...";
|
|
||||||
$new_licenses = get_license_nodes($generated_license_file_path);
|
|
||||||
unlink($generated_license_file_path);
|
|
||||||
|
|
||||||
foreach ($old_licenses as $b) {
|
|
||||||
$aProductNode = get_product_node($b);
|
|
||||||
|
|
||||||
if (get_scope($aProductNode) !== "lib" && get_scope($aProductNode) !== "datamodels") {
|
|
||||||
$new_licenses[] = $b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
usort($new_licenses, 'sort_by_product');
|
|
||||||
echo "OK!\n";
|
|
||||||
|
|
||||||
echo "- Overwritting Combodo license file...";
|
|
||||||
$new_dom = new DOMDocument("1.0");
|
|
||||||
$new_dom->formatOutput = true;
|
|
||||||
$root = $new_dom->createElement("licenses");
|
|
||||||
$new_dom->appendChild($root);
|
|
||||||
|
|
||||||
foreach ($new_licenses as $b) {
|
|
||||||
$node = $new_dom->importNode($b, true);
|
|
||||||
|
|
||||||
// N°3870 fix when running script in Windows
|
|
||||||
// fix should be in gen-community-license.sh but it is easier to do it here !
|
|
||||||
if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
|
|
||||||
$oProductNodeOrig = get_product_node($node);
|
|
||||||
fix_product_name($oProductNodeOrig);
|
|
||||||
}
|
|
||||||
|
|
||||||
$root->appendChild($node);
|
|
||||||
}
|
|
||||||
|
|
||||||
$new_dom->save($xmlFilePath);
|
|
||||||
echo "OK!\n";
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Usage :
|
|
||||||
* `php changelog.php 2.7.4`
|
|
||||||
*
|
|
||||||
* As argument is passed the git ref (tag name or sha1) we want to use as reference
|
|
||||||
*
|
|
||||||
* Outputs :
|
|
||||||
*
|
|
||||||
* 1. List of bugs as CSV :
|
|
||||||
* bug ref;link
|
|
||||||
* Example :
|
|
||||||
* <code>
|
|
||||||
* Bug_ref;Bug_URL;sha1
|
|
||||||
* 1234;https://support.combodo.com/pages/UI.php?operation=details&class=Bug&id=1234;949b213f9|b1ca1f263|a1271da74
|
|
||||||
* </code>
|
|
||||||
*
|
|
||||||
* 2. List of commits sha1/message without bug ref
|
|
||||||
* Example :
|
|
||||||
* <code>
|
|
||||||
* sha1;subject
|
|
||||||
* a6aa183e2;:bookmark: Prepare 2.7.5
|
|
||||||
* </code>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
if (count($argv) === 1) {
|
|
||||||
echo '⚠ You must pass the base tag/sha1 as parameter';
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
$sBaseReference = $argv[1];
|
|
||||||
|
|
||||||
|
|
||||||
//--- Get log
|
|
||||||
$sGitLogCommand = 'git log --decorate --pretty="%h;%s" --date-order --no-merges '.$sBaseReference.'..HEAD';
|
|
||||||
$sGitLogRaw = shell_exec($sGitLogCommand);
|
|
||||||
|
|
||||||
|
|
||||||
//--- Analyze log
|
|
||||||
$aGitLogLines = preg_split('/\n/', trim($sGitLogRaw));;
|
|
||||||
$aLogLinesWithBugRef = [];
|
|
||||||
$aLogLineNoBug = [];
|
|
||||||
foreach ($aGitLogLines as $sLogLine) {
|
|
||||||
$sBugRef = preg_match('/[nN]°(\d{3,4})/', $sLogLine, $aLineBugRef);
|
|
||||||
if (($sBugRef === false) || empty($aLineBugRef)) {
|
|
||||||
$aLogLineNoBug[] = $sLogLine;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$iBugId = $aLineBugRef[1];
|
|
||||||
$sSha = substr($sLogLine, 0, 9);
|
|
||||||
|
|
||||||
if (array_key_exists($iBugId, $aLogLinesWithBugRef)) {
|
|
||||||
$aBugShaRefs = $aLogLinesWithBugRef[$iBugId];
|
|
||||||
$aBugShaRefs[] = $sSha;
|
|
||||||
$aLogLinesWithBugRef[$iBugId] = $aBugShaRefs;
|
|
||||||
} else {
|
|
||||||
$aLogLinesWithBugRef[$iBugId] = [$sSha];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$aBugsList = array_keys($aLogLinesWithBugRef);
|
|
||||||
sort($aBugsList, SORT_NUMERIC);
|
|
||||||
|
|
||||||
|
|
||||||
//-- Output results
|
|
||||||
echo "# Bugs included\n";
|
|
||||||
echo "Bug_ref;Bug_URL;sha1\n";
|
|
||||||
foreach ($aBugsList as $sBugRef) {
|
|
||||||
$sShaRefs = implode('|', $aLogLinesWithBugRef[$sBugRef]);
|
|
||||||
echo "{$sBugRef};https://support.combodo.com/pages/UI.php?operation=details&class=Bug&id={$sBugRef};$sShaRefs\n";
|
|
||||||
}
|
|
||||||
echo "\n";
|
|
||||||
echo "# Logs line without bug referenced\n";
|
|
||||||
echo "sha1;subject\n";
|
|
||||||
foreach ($aLogLineNoBug as $sLogLine) {
|
|
||||||
echo "$sLogLine\n";
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Tool to automate version update before release
|
|
||||||
*
|
|
||||||
* Will update version in the following files :
|
|
||||||
*
|
|
||||||
* * datamodels/2.x/.../module.*.php
|
|
||||||
* * datamodels/2.x/version.xml
|
|
||||||
* * css/css-variables.scss $version
|
|
||||||
*
|
|
||||||
* Usage :
|
|
||||||
* `php .make\release\update-versions.php "2.7.0-rc"`
|
|
||||||
*
|
|
||||||
* @since 2.7.0
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once (__DIR__.'/../../approot.inc.php');
|
|
||||||
require_once (__DIR__.DIRECTORY_SEPARATOR.'update.classes.inc.php');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @var \FileVersionUpdater[] $aFilesUpdaters */
|
|
||||||
$aFilesUpdaters = array(
|
|
||||||
new iTopVersionFileUpdater(),
|
|
||||||
new DatamodelsModulesFiles(),
|
|
||||||
new ConstantFileUpdater('ITOP_CORE_VERSION', 'approot.inc.php'),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (count($argv) === 1)
|
|
||||||
{
|
|
||||||
echo '/!\ You must pass the new version as parameter';
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
$sVersionLabel = $argv[1];
|
|
||||||
if (empty($sVersionLabel))
|
|
||||||
{
|
|
||||||
echo 'Version passed as parameter is empty !';
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($aFilesUpdaters as $oFileVersionUpdater)
|
|
||||||
{
|
|
||||||
$oFileVersionUpdater->UpdateAllFiles($sVersionLabel);
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Tool to automate datamodel version update in XML
|
|
||||||
*
|
|
||||||
* Will update version in the following files :
|
|
||||||
*
|
|
||||||
* datamodels/2.x/.../datamodel.*.xml
|
|
||||||
* application/*.xml
|
|
||||||
* core/*.xml
|
|
||||||
*
|
|
||||||
* Usage :
|
|
||||||
* `php .make\release\update-xml.php "1.7"`
|
|
||||||
* `php .make\release\update-xml.php`
|
|
||||||
*
|
|
||||||
* If no parameter provided then the current XML version will be used as target version
|
|
||||||
*
|
|
||||||
* @since 2.7.0 simple version change using regexp (not doing conversion)
|
|
||||||
* @since 3.1.0 N°5405 now does a real conversion
|
|
||||||
* @since 3.1.0 N°5633 allow to use without parameter
|
|
||||||
* @since 3.1.0 N°5633 add /application and /core XML files
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once (__DIR__.'/../../approot.inc.php');
|
|
||||||
require_once (__DIR__.DIRECTORY_SEPARATOR.'update.classes.inc.php');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (count($argv) === 1)
|
|
||||||
{
|
|
||||||
echo '/!\ No version passed: assuming target XML version is current XML version ('.ITOP_DESIGN_LATEST_VERSION.")\n";
|
|
||||||
$sVersionLabel = ITOP_DESIGN_LATEST_VERSION;
|
|
||||||
} else {
|
|
||||||
$sVersionLabel = $argv[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($sVersionLabel))
|
|
||||||
{
|
|
||||||
echo 'Version passed as parameter is empty !';
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oFileVersionUpdater = new DatamodelsXmlFiles();
|
|
||||||
$oFileVersionUpdater->UpdateAllFiles($sVersionLabel);
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Classes for updater tools
|
|
||||||
*
|
|
||||||
* @see update-versions.php
|
|
||||||
* @see update-xml.php
|
|
||||||
******************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once (__DIR__.'/../../approot.inc.php');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
abstract class FileVersionUpdater
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return string[] full path of files to modify
|
|
||||||
*/
|
|
||||||
abstract public function GetFiles();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Warnign : will consume lots of memory on larger files !
|
|
||||||
*
|
|
||||||
* @param string $sVersionLabel
|
|
||||||
* @param string $sFileContent
|
|
||||||
* @param string $sFileFullPath
|
|
||||||
*
|
|
||||||
* @return string file content with replaced values
|
|
||||||
*/
|
|
||||||
abstract public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath);
|
|
||||||
|
|
||||||
public function UpdateAllFiles($sVersionLabel)
|
|
||||||
{
|
|
||||||
$aFilesToUpdate = $this->GetFiles();
|
|
||||||
$sFileUpdaterName = get_class($this);
|
|
||||||
echo "# Updater : $sFileUpdaterName\n";
|
|
||||||
foreach ($aFilesToUpdate as $sFileToUpdateFullPath)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$sCurrentFileContent = file_get_contents($sFileToUpdateFullPath);
|
|
||||||
$sNewFileContent = $this->UpdateFileContent($sVersionLabel, $sCurrentFileContent, $sFileToUpdateFullPath);
|
|
||||||
file_put_contents($sFileToUpdateFullPath, $sNewFileContent);
|
|
||||||
echo " - $sFileToUpdateFullPath : OK !\n";
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
echo " - $sFileToUpdateFullPath : Error :(\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class AbstractSingleFileVersionUpdater extends FileVersionUpdater
|
|
||||||
{
|
|
||||||
private $sFileToUpdate;
|
|
||||||
|
|
||||||
public function __construct($sFileToUpdate)
|
|
||||||
{
|
|
||||||
$this->sFileToUpdate = $sFileToUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function GetFiles()
|
|
||||||
{
|
|
||||||
return array(APPROOT.$this->sFileToUpdate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 2.7.7 3.0.1 3.1.0 N°4714
|
|
||||||
*/
|
|
||||||
class ConstantFileUpdater extends AbstractSingleFileVersionUpdater {
|
|
||||||
/** @var string */
|
|
||||||
private $sConstantName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $sConstantName constant to search, for example `ITOP_CORE_VERSION`
|
|
||||||
* @param $sFileToUpdate file containing constant definition
|
|
||||||
*/
|
|
||||||
public function __construct($sConstantName, $sFileToUpdate)
|
|
||||||
{
|
|
||||||
$this->sConstantName = $sConstantName;
|
|
||||||
parent::__construct($sFileToUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath)
|
|
||||||
{
|
|
||||||
$sConstantSearchPattern = <<<REGEXP
|
|
||||||
/define\('{$this->sConstantName}', ?'[^']+'\);/
|
|
||||||
REGEXP;
|
|
||||||
|
|
||||||
return preg_replace(
|
|
||||||
$sConstantSearchPattern,
|
|
||||||
"define('{$this->sConstantName}', '{$sVersionLabel}');",
|
|
||||||
$sFileContent
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class iTopVersionFileUpdater extends AbstractSingleFileVersionUpdater
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct('datamodels/2.x/version.xml');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath)
|
|
||||||
{
|
|
||||||
return preg_replace(
|
|
||||||
'/(<version>)[^<]*(<\/version>)/',
|
|
||||||
'${1}'.$sVersionLabel.'${2}',
|
|
||||||
$sFileContent
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class AbstractGlobFileVersionUpdater extends FileVersionUpdater
|
|
||||||
{
|
|
||||||
/** @var array|string glob patterns to seek for files to modify */
|
|
||||||
protected $globPattern;
|
|
||||||
|
|
||||||
public function __construct($globPattern)
|
|
||||||
{
|
|
||||||
$this->globPattern = $globPattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function GetFiles()
|
|
||||||
{
|
|
||||||
$aGlobPatterns = (is_array($this->globPattern))
|
|
||||||
? $this->globPattern
|
|
||||||
: [$this->globPattern];
|
|
||||||
|
|
||||||
$aFiles = [];
|
|
||||||
foreach ($aGlobPatterns as $sGlobPattern) {
|
|
||||||
$result = glob($sGlobPattern);
|
|
||||||
if (false === $result) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/** @noinspection SlowArrayOperationsInLoopInspection */
|
|
||||||
$aFiles = array_merge($aFiles, $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $aFiles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DatamodelsModulesFiles extends AbstractGlobFileVersionUpdater
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct(APPROOT.'datamodels/2.x/*/module.*.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath)
|
|
||||||
{
|
|
||||||
$sModulePath = realpath($sFileFullPath);
|
|
||||||
$sModuleFileName = basename($sModulePath, 1);
|
|
||||||
$sModuleName = preg_replace('/[^.]+\.([^.]+)\.php/', '$1', $sModuleFileName);
|
|
||||||
|
|
||||||
return preg_replace(
|
|
||||||
"/('$sModuleName\/)[^']+(')/",
|
|
||||||
'${1}'.$sVersionLabel.'${2}',
|
|
||||||
$sFileContent
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
|
|
||||||
{
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct([
|
|
||||||
APPROOT.'datamodels/2.x/*/datamodel.*.xml',
|
|
||||||
APPROOT.'application/*.xml',
|
|
||||||
APPROOT.'core/*.xml',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function UpdateFileContent($sVersionLabel, $sFileContent, $sFileFullPath)
|
|
||||||
{
|
|
||||||
require_once APPROOT.'setup/itopdesignformat.class.inc.php';
|
|
||||||
$oFileXml = new DOMDocument();
|
|
||||||
/** @noinspection PhpComposerExtensionStubsInspection */
|
|
||||||
libxml_clear_errors();
|
|
||||||
$oFileXml->formatOutput = true;
|
|
||||||
$oFileXml->preserveWhiteSpace = false;
|
|
||||||
$oFileXml->loadXML($sFileContent);
|
|
||||||
|
|
||||||
$oFileItopFormat = new iTopDesignFormat($oFileXml);
|
|
||||||
|
|
||||||
$sDesignVersionToSet = static::GetDesignVersionToSet($oFileItopFormat->GetVersion());
|
|
||||||
if (false === is_null($sDesignVersionToSet)) {
|
|
||||||
// N°5779 if same as target version, we will try to convert from version below
|
|
||||||
$oFileItopFormat->GetITopDesignNode()->setAttribute('version', $sDesignVersionToSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
$bConversionResult = $oFileItopFormat->Convert($sVersionLabel);
|
|
||||||
|
|
||||||
if (false === $bConversionResult) {
|
|
||||||
throw new Exception("Error when converting $sFileFullPath");
|
|
||||||
}
|
|
||||||
|
|
||||||
return $oFileItopFormat->GetXmlAsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ?string version to use : if file version is same as current version then return previous version, else return null
|
|
||||||
* @since 3.1.0 N°5779
|
|
||||||
*/
|
|
||||||
protected static function GetDesignVersionToSet($sFileDesignVersion):?string {
|
|
||||||
if ($sFileDesignVersion !== ITOP_DESIGN_LATEST_VERSION) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return iTopDesignFormat::GetPreviousDesignVersion(ITOP_DESIGN_LATEST_VERSION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
164
CONTRIBUTING.md
164
CONTRIBUTING.md
@@ -1,164 +0,0 @@
|
|||||||
# Contributing to iTop
|
|
||||||
|
|
||||||
You want to contribute to iTop? Many thanks to you! 🎉 👍
|
|
||||||
|
|
||||||
Here are some guidelines that will help us integrate your work!
|
|
||||||
|
|
||||||
|
|
||||||
## Contributions
|
|
||||||
|
|
||||||
### Subjects
|
|
||||||
You are welcome to create pull requests on any of those subjects:
|
|
||||||
|
|
||||||
* 🐛 bug fix
|
|
||||||
* 🌐 translation / i18n / l10n
|
|
||||||
|
|
||||||
If you want to implement a **new feature**, please [create a corresponding ticket](https://sourceforge.net/p/itop/tickets/new/) for review.
|
|
||||||
If you ever want to begin implementation, do so in a fork, and add a link to the corresponding commits in the ticket.
|
|
||||||
|
|
||||||
For all **security related subjects**, please see our [security policy](SECURITY.md).
|
|
||||||
|
|
||||||
All **datamodel modification** should be done in an extension. Beware that such change would
|
|
||||||
impact all existing customers, and could prevent them from
|
|
||||||
upgrading!
|
|
||||||
Combodo has a long experience of datamodel changes: they are very disruptive!
|
|
||||||
This is why we avoid them in iTop core, especially the changes on existing objects/fields.
|
|
||||||
If you have an idea you're sure would benefit to all of iTop users, you may
|
|
||||||
[create a corresponding ticket](https://sourceforge.net/p/itop/tickets/new/) to submit it, but be warned that there are lots of good
|
|
||||||
reasons to refuse such changes.
|
|
||||||
|
|
||||||
### 📄 License and copyright
|
|
||||||
iTop is distributed under the AGPL-3.0 license (see the [license.txt] file).
|
|
||||||
|
|
||||||
The iTop repository is divided in three parts: iTop (mainly PHP/JS/XML sources and dictionaries), images, and third-party libraries.
|
|
||||||
Combodo has the copyright on most of the source files in the iTop part of the repository: please do not modify the existing file copyrights.
|
|
||||||
Anyhow, you are encouraged to signal your contribution by the mean of `@author` annotations.
|
|
||||||
|
|
||||||
If you want to use another license or keep the code ownership (copyright), you may [create an extension][wiki new ext].
|
|
||||||
|
|
||||||
[license.txt]: https://github.com/Combodo/iTop/blob/develop/license.txt
|
|
||||||
[wiki new ext]: https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Astart#by_writing_your_own_extension
|
|
||||||
|
|
||||||
|
|
||||||
## 🔀 iTop branch model
|
|
||||||
|
|
||||||
When we first start with Git, we were using the [GitFlow](https://nvie.com/posts/a-successful-git-branching-model/) branch model. As
|
|
||||||
there was some confusions about branches to use for current developed release and previous maintained release, and also because we were
|
|
||||||
using just a very few of the GitFlow commands, we decided to add just a little modification to this branch model : since april 2020
|
|
||||||
we don't have a `master` branch anymore.
|
|
||||||
|
|
||||||
Here are the branches we use and their meaning :
|
|
||||||
|
|
||||||
- `develop`: ongoing development version
|
|
||||||
- `release/*`: if present, that means we are working on a alpha/beta/rc version for shipping
|
|
||||||
- `support/*`: maintenance branches for older versions
|
|
||||||
|
|
||||||
For example, if no version is currently prepared for shipping we could have:
|
|
||||||
|
|
||||||
- `develop` containing future 3.1.0 version
|
|
||||||
- `support/3.0`: 3.0.x maintenance version
|
|
||||||
- `support/2.7`: 2.7.x maintenance version
|
|
||||||
- `support/2.6`: 2.6.x maintenance version
|
|
||||||
|
|
||||||
In this example, when 3.1.0-beta is shipped that will become:
|
|
||||||
|
|
||||||
- `develop`: future 3.2.0 version
|
|
||||||
- `release/3.1.0`: 3.1.0-beta
|
|
||||||
- `support/3.0`: 3.0.x maintenance version
|
|
||||||
- `support/2.7`: 2.7.x maintenance version
|
|
||||||
- `support/2.6`: 2.6.x maintenance version
|
|
||||||
|
|
||||||
And when 3.1.0 final will be out:
|
|
||||||
|
|
||||||
- `develop`: future 3.2.0 version
|
|
||||||
- `support/3.1`: 3.1.x maintenance version (will host developments for 3.1.1)
|
|
||||||
- `support/3.0`: 3.0.x maintenance version
|
|
||||||
- `support/2.7`: 2.7.x maintenance version
|
|
||||||
- `support/2.6`: 2.6.x maintenance version
|
|
||||||
|
|
||||||
Also note that we have a "micro-version" concept : each of those versions have a very small amount of modifications. They are made from
|
|
||||||
`support/*` branches as well. For example 2.6.2-1 and 2.6.2-2 were made from the `support/2.6.2` branch.
|
|
||||||
|
|
||||||
|
|
||||||
## Coding
|
|
||||||
|
|
||||||
### 🌐 Translations
|
|
||||||
|
|
||||||
A [dedicated page](https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Atranslation) is available in the official wiki.
|
|
||||||
|
|
||||||
### Where to start ?
|
|
||||||
|
|
||||||
1. Create a fork from our repository (see [Working with forks - GitHub Help](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/working-with-forks))
|
|
||||||
2. Create a branch in this fork, based on the develop branch
|
|
||||||
3. Code !
|
|
||||||
|
|
||||||
Do create a dedicated branch for each modification you want to propose : if you don't it will be very hard to merge back your work !
|
|
||||||
|
|
||||||
Most of the time you should based your developments on the develop branch.
|
|
||||||
That may be different if you want to fix a bug, please use develop anyway and ask in your PR if rebase is possible.
|
|
||||||
|
|
||||||
|
|
||||||
### 🎨 PHP styleguide
|
|
||||||
|
|
||||||
Please follow [our guidelines](https://www.itophub.io/wiki/page?id=latest%3Acustomization%3Acoding_standards).
|
|
||||||
|
|
||||||
### ✅ Tests
|
|
||||||
|
|
||||||
Please create tests that covers as much as possible the code you're submitting.
|
|
||||||
|
|
||||||
Our tests are located in the `test/` directory, containing a PHPUnit config file : `phpunit.xml.dist`.
|
|
||||||
|
|
||||||
### Git Commit Messages
|
|
||||||
|
|
||||||
* Describe the functional change instead of the technical modifications
|
|
||||||
* Use the present tense ("Add feature" not "Added feature")
|
|
||||||
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
|
|
||||||
* Limit the first line to 72 characters or less
|
|
||||||
* Please start the commit message with an applicable emoji code (following the [Gitmoji guide](https://gitmoji.dev/)).
|
|
||||||
Beware to use the code (for example `:bug:`) and not the character (🐛) as Unicode support in git clients is very poor for now...
|
|
||||||
Emoji examples :
|
|
||||||
* 🌐 `:globe_with_meridians:` for translations
|
|
||||||
* 🎨 `:art:` when improving the format/structure of the code
|
|
||||||
* ⚡️ `:zap:` when improving performance
|
|
||||||
* 🐛 `:bug:` when fixing a bug
|
|
||||||
* 🔥 `:fire:` when removing code or files
|
|
||||||
* 💚 `:green_heart:` when fixing the CI build
|
|
||||||
* ✅ `:white_check_mark:` when adding tests
|
|
||||||
* 🔒 `:lock:` when dealing with security
|
|
||||||
* ⬆️ `:arrow_up:` when upgrading dependencies
|
|
||||||
* ⬇️ `:arrow_down:` when downgrading dependencies
|
|
||||||
* ♻️ `:recycle:` code refactoring
|
|
||||||
* 💄 `:lipstick:` Updating the UI and style files.
|
|
||||||
|
|
||||||
## 👥 Pull request
|
|
||||||
|
|
||||||
When your code is working, please:
|
|
||||||
|
|
||||||
* Squash as much as possible your commits,
|
|
||||||
* Rebase your branch on our repo last commit,
|
|
||||||
* Create a pull request. _Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/)_.
|
|
||||||
* Pull request description: mind to add all the information useful to understand why you're suggesting this modification and anything necessary to dive into your work. Especially:
|
|
||||||
- Bugfixes: exact steps to reproduce the bug (given/when/then), description of the bug cause and what solution is implemented
|
|
||||||
- Enhancements: use cases, implementation details if needed
|
|
||||||
* Mind to check the "[Allow edits from maintainers](https://docs.github.com/en/github-ae@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" option ! (note that if you are working with an org fork, this option [won't be available](https://github.com/orgs/community/discussions/5634))
|
|
||||||
|
|
||||||
|
|
||||||
## 🙏 We are thankful
|
|
||||||
|
|
||||||
We are thankful for all your contributions to the iTop universe! As a thank you gift, we will send stickers to every iTop (& extensions) contributors!
|
|
||||||
|
|
||||||
We have one sticker per contribution type. You might get multiple stickers with one contribution though :)
|
|
||||||
|
|
||||||
* Bug hunter: Fix a bug
|
|
||||||
* Translator: Add/update translations
|
|
||||||
* White hat: Find and/or fix a vulnerability
|
|
||||||
* Contributor: Contribute by finding a bug, making an extension or any other way
|
|
||||||
* Partner: For Combodo's official partners
|
|
||||||
* Graduated: Follow a Combodo's iTop training
|
|
||||||
* Ambassador: Outstanding community contributors
|
|
||||||
* Beta tester: Test and give feedback on beta releases
|
|
||||||
* Extension developer: Develop and publish an extension
|
|
||||||
|
|
||||||
Here is the design of each stickers for year 2024:
|
|
||||||
|
|
||||||

|
|
||||||
19
Jenkinsfile
vendored
19
Jenkinsfile
vendored
@@ -1,19 +0,0 @@
|
|||||||
def infra
|
|
||||||
|
|
||||||
node(){
|
|
||||||
properties([
|
|
||||||
buildDiscarder(
|
|
||||||
logRotator(
|
|
||||||
daysToKeepStr: "28",
|
|
||||||
numToKeepStr: "500")
|
|
||||||
)
|
|
||||||
])
|
|
||||||
|
|
||||||
checkout scm
|
|
||||||
|
|
||||||
infra = load '/var/lib/jenkins/workspace/itop-test-infra_master/src/Infra.groovy'
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
infra.call()
|
|
||||||
|
|
||||||
138
README.md
138
README.md
@@ -1,138 +0,0 @@
|
|||||||
<p align="center"><a href="https://www.combodo.com/itop-193" target="_blank">
|
|
||||||
<img src="https://www.combodo.com/logos/logo-itop-baseline.svg" width=350>
|
|
||||||
</a></p>
|
|
||||||
|
|
||||||
|
|
||||||
iTop stands for IT Operations Portal. It is a complete open source and web-based IT service management platform, including a fully customizable CMDB, a helpdesk system, and a document management tool. It is ITIL compliant and easily customizable and extensible thanks to a high number of add-ons and web services to integrate with your IT.
|
|
||||||
|
|
||||||
iTop also offers mass import tools to help you become even more efficient.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
- Fully configurable [Configuration Management (CMDB)][10]
|
|
||||||
- [HelpDesk][11] and Incident Management
|
|
||||||
- [Service and Contract Management][12]
|
|
||||||
- [Change][13] Management
|
|
||||||
- Configurable [SLA][14] Management
|
|
||||||
- Graphical [impact analysis][15]
|
|
||||||
- [CSV import][16] tool for any data
|
|
||||||
- Consistency [audit][17] to check data quality
|
|
||||||
- [Data synchronization][18] (for data federation)
|
|
||||||
|
|
||||||
|
|
||||||
## Latest release
|
|
||||||
|
|
||||||
- [Changes since the previous version][62]
|
|
||||||
- [New features][63]
|
|
||||||
- [Installation notes][64]
|
|
||||||
- [Download][65]
|
|
||||||
|
|
||||||
[62]: https://www.itophub.io/wiki/page?id=latest:release:change_log
|
|
||||||
[63]: https://www.itophub.io/wiki/page?id=latest:release:start
|
|
||||||
[64]: https://www.itophub.io/wiki/page?id=latest:install:start
|
|
||||||
[65]: https://sourceforge.net/projects/itop/files/latest/download
|
|
||||||
|
|
||||||
|
|
||||||
## Resources
|
|
||||||
|
|
||||||
- [iTop Forums][1]: community support
|
|
||||||
- [iTop Tickets][2]: for feature requests and bug reports
|
|
||||||
- [Releases download][3]
|
|
||||||
- [iTop requirements][4]
|
|
||||||
- [Documentation][5] covering both iTop and its official extensions
|
|
||||||
- [iTop Hub][6] : discover and install extensions !
|
|
||||||
- [iTop versions history][7]
|
|
||||||
|
|
||||||
|
|
||||||
[1]: https://sourceforge.net/p/itop/discussion/
|
|
||||||
[2]: https://sourceforge.net/p/itop/tickets/
|
|
||||||
[3]: https://sourceforge.net/projects/itop/files/itop/
|
|
||||||
[4]: https://www.itophub.io/wiki/page?id=latest:install:requirements
|
|
||||||
[5]: https://www.itophub.io/wiki
|
|
||||||
[6]: https://store.itophub.io/en_US/
|
|
||||||
[7]: .doc/itop-version-history.md
|
|
||||||
|
|
||||||
[10]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#configuration_management_cmdb
|
|
||||||
[11]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#ticketing
|
|
||||||
[12]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#service_management
|
|
||||||
[13]: https://www.itophub.io/wiki/page?id=latest%3Adatamodel%3Astart#change_management
|
|
||||||
[14]: https://www.itophub.io/wiki/page?id=latest%3Aimplementation%3Astart#service_level_agreements_and_targets
|
|
||||||
[15]: https://www.itophub.io/wiki/page?id=latest%3Auser%3Aactions#relations
|
|
||||||
[16]: https://www.itophub.io/wiki/page?id=latest%3Auser%3Abulk_modify#uploading_data
|
|
||||||
[17]: https://www.itophub.io/wiki/page?id=latest%3Aadmin%3Aaudit
|
|
||||||
[18]: https://www.itophub.io/wiki/page?id=latest%3Aadvancedtopics%3Adata_synchro_overview
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## About Us
|
|
||||||
|
|
||||||
iTop development is sponsored, led, and supported by [Combodo][0].
|
|
||||||
|
|
||||||
[0]: https://www.combodo.com
|
|
||||||
|
|
||||||
|
|
||||||
## Contributors
|
|
||||||
|
|
||||||
We would like to give a special thank you 🤗 to the people from the community who contributed to this project, including:
|
|
||||||
|
|
||||||
### Names
|
|
||||||
|
|
||||||
- Alves, David
|
|
||||||
- Beck, Pedro
|
|
||||||
- Beer, Christian (a.k.a [@ChristianBeer](https://www.github.com/ChristianBeer))
|
|
||||||
- Bilger, Jean-François
|
|
||||||
- Bostoen, Jeffrey (a.k.a [@jbostoen](https://www.github.com/jbostoen))
|
|
||||||
- Cardoso, Anderson
|
|
||||||
- Cassaro, Bruno
|
|
||||||
- Casteleyn, Thomas (a.k.a [@Hipska](https://www.github.com/Hipska))
|
|
||||||
- Castro, Randall Badilla
|
|
||||||
- Colantoni, Maria Laura
|
|
||||||
- Couronné, Guy
|
|
||||||
- Dejin, Bie (a.k.a [@bdejin](https://github.com/bdejin))
|
|
||||||
- Dvořák, Lukáš
|
|
||||||
- Goethals, Stefan
|
|
||||||
- Gumble, David
|
|
||||||
- Ji, Leeb (冀利斌) (a.k.a [@chileeb](https://github.com/chileeb))
|
|
||||||
- Kaltefleiter, Lars (a.k.a [@larhip](https://www.github.com/larhip))
|
|
||||||
- Khamit, Shamil
|
|
||||||
- Kincel, Martin
|
|
||||||
- Konečný, Kamil
|
|
||||||
- Kunin, Vladimir
|
|
||||||
- Lassiter, Dennis
|
|
||||||
- Lazcano, Federico
|
|
||||||
- Lucas, Jonathan
|
|
||||||
- Malik, Remie
|
|
||||||
- Mindêllo de Andrade, Lucas (a.k.a [@rokam](https://www.github.com/rokam))
|
|
||||||
- Mozart de Oliveira, Eduardo (a.k.a [@eduardomozart](https://github.com/eduardomozart))
|
|
||||||
- Raenker, Martin
|
|
||||||
- Roháč, Richard (a.k.a [@RohacRichard](https://github.com/RohacRichard))
|
|
||||||
- Rosenke, Stephan
|
|
||||||
- Rudner, Björn (a.k.a [@rudnerbjoern](https://github.com/rudnerbjoern))
|
|
||||||
- Šafránek, Jaroslav (a.k.a [jkcinik](https://sourceforge.net/u/jkcinik/profile/) on SourceForge)
|
|
||||||
- Seki, Shoji
|
|
||||||
- Shilov, Vladimir
|
|
||||||
- Stetina, Pavel (a.k.a [@Stetinac](https://github.com/Stetinac))
|
|
||||||
- Stukalov, Ilya (a.k.a [@ilya](https://www.github.com/ilya)-stukalov)
|
|
||||||
- Tarjányi, Csaba (a.k.a [@tacsaby](https://github.com/tacsaby))
|
|
||||||
- Tulio, Marco
|
|
||||||
- Turrubiates, Miguel
|
|
||||||
|
|
||||||
### Aliases
|
|
||||||
|
|
||||||
- chifu1234
|
|
||||||
- cprobst
|
|
||||||
- DudekArtur
|
|
||||||
- Karkoff1212
|
|
||||||
- Laura
|
|
||||||
- nv35
|
|
||||||
- Purple Grape
|
|
||||||
- Schlobinux
|
|
||||||
- theBigOne
|
|
||||||
- ulmerspatz
|
|
||||||
|
|
||||||
### Companies
|
|
||||||
|
|
||||||
- [Hardis](https://www.hardis-group.com/)
|
|
||||||
- [ITOMIG](https://www.itomig.de/)
|
|
||||||
- [Pimkie](https://www.pimkie.com/)
|
|
||||||
- [Super-Visions](https://www.super-visions.com/)
|
|
||||||
|
|
||||||
44
SECURITY.md
44
SECURITY.md
@@ -1,44 +0,0 @@
|
|||||||
# 🔒 Reporting vulnerabilities
|
|
||||||
|
|
||||||
We take all security bugs seriously. Thank you for improving the security of iTop! We appreciate your efforts and
|
|
||||||
responsible disclosure and will make every effort to acknowledge your contributions.
|
|
||||||
|
|
||||||
|
|
||||||
## ✉️ How to report
|
|
||||||
|
|
||||||
### iTop vulnerabilities
|
|
||||||
Please send a procedure to reproduce iTop vulnerabilities to [itop-security@combodo.com](mailto:itop-security@combodo.com).
|
|
||||||
|
|
||||||
You can send us a standard "given / when / then" report, including iTop version, impacts, and maybe installed modules or data if they are
|
|
||||||
needed to reproduce.
|
|
||||||
|
|
||||||
### Dependencies vulnerabilities
|
|
||||||
Report security bugs in third-party modules to the person or team maintaining the module, and notify us of this report by sending an email
|
|
||||||
to [itop-security@combodo.com](mailto:itop-security@combodo.com).
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 🔍 Combodo acknowledgment and investigation
|
|
||||||
Report sent to us will be acknowledged within the week.
|
|
||||||
|
|
||||||
Then, a Combodo developer will be assigned to the reported issue and will:
|
|
||||||
|
|
||||||
* confirm the problem and determine the affected iTop versions
|
|
||||||
* audit the code to search any potential similar problems
|
|
||||||
* try to find a workaround if any
|
|
||||||
* create fixes for all releases still under maintenance
|
|
||||||
* send you the commit(s) for review
|
|
||||||
* send you the next version(s) that will contain the fix, and the estimated release dates
|
|
||||||
|
|
||||||
Security issues always take precedence over bug fixes and feature work.
|
|
||||||
|
|
||||||
The assignee will keep you informed of the resolution progress, and may ask you for additional information or guidance.
|
|
||||||
|
|
||||||
|
|
||||||
## 📆 Disclosure Policy
|
|
||||||
Once the fix is done and acknowledged by every stakeholder, it will be included in the next iTop version.
|
|
||||||
Mind we have at least 2 active branches (LTS and STS, see [iTop Community Releases [iTop Documentation]](https://www.itophub.io/wiki/page?id=latest:release:start))
|
|
||||||
|
|
||||||
The release communications will include the information of the vulnerability fix.
|
|
||||||
|
|
||||||
Corresponding GitHub advisories and CVE will be published 3 months after the iTop version release date so that iTop instances can be updated.
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
//
|
//
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
/**
|
/**
|
||||||
* UserRightsMatrix (User management Module)
|
* UserRightsMatrix (User management Module)
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -127,8 +127,14 @@ class UserRightsMatrix extends UserRightsAddOnAPI
|
|||||||
$oUser->Set('contactid', 1); // one is for root !
|
$oUser->Set('contactid', 1); // one is for root !
|
||||||
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
||||||
|
|
||||||
|
// Create a change to record the history of the User object
|
||||||
|
$oChange = MetaModel::NewObject("CMDBChange");
|
||||||
|
$oChange->Set("date", time());
|
||||||
|
$oChange->Set("userinfo", "Initialization");
|
||||||
|
$iChangeId = $oChange->DBInsert();
|
||||||
|
|
||||||
// Now record the admin user object
|
// Now record the admin user object
|
||||||
$iUserId = $oUser->DBInsertNoReload();
|
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
$this->SetupUser($iUserId, true);
|
$this->SetupUser($iUserId, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
//
|
//
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
* UserRightsNull
|
* UserRightsNull
|
||||||
* User management Module - say Yeah! to everything
|
* User management Module - say Yeah! to everything
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
// Copyright (C) 2010-2013 Combodo SARL
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
//
|
||||||
|
// This file is part of iTop.
|
||||||
|
//
|
||||||
|
// iTop is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// iTop is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserRightsProfile
|
||||||
|
* User management Module, basing the right on profiles and a matrix (similar to UserRightsMatrix, but profiles and other decorations have been added)
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Combodo\iTop\Application\WebPage\WebPage;
|
|
||||||
|
|
||||||
define('ADMIN_PROFILE_NAME', 'Administrator');
|
define('ADMIN_PROFILE_NAME', 'Administrator');
|
||||||
define('PORTAL_PROFILE_NAME', 'Portal user');
|
define('PORTAL_PROFILE_NAME', 'Portal user');
|
||||||
|
|
||||||
@@ -36,15 +54,15 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "addon/userrights,grant_by_profile,filter",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"complementary_name_attcode" => array('description'),
|
"state_attcode" => "",
|
||||||
"state_attcode" => "",
|
"reconc_keys" => array(),
|
||||||
"reconc_keys" => array(),
|
"db_table" => "priv_urp_profiles",
|
||||||
"db_table" => "priv_urp_profiles",
|
"db_key_field" => "id",
|
||||||
"db_key_field" => "id",
|
"db_finalclass_field" => "",
|
||||||
"db_finalclass_field" => "",
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -57,8 +75,8 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('name','description')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array ('name','description'));
|
MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static $m_aCacheProfiles = null;
|
protected static $m_aCacheProfiles = null;
|
||||||
@@ -119,15 +137,18 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
$oUserRights = UserRights::GetModuleInstance();
|
$oUserRights = UserRights::GetModuleInstance();
|
||||||
|
|
||||||
$aDisplayData = array();
|
$aDisplayData = array();
|
||||||
foreach (MetaModel::GetClasses('bizmodel,grant_by_profile') as $sClass)
|
foreach (MetaModel::GetClasses('bizmodel') as $sClass)
|
||||||
{
|
{
|
||||||
|
// Skip non instantiable classes
|
||||||
|
if (MetaModel::IsAbstract($sClass)) continue;
|
||||||
|
|
||||||
$aStimuli = array();
|
$aStimuli = array();
|
||||||
foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus)
|
foreach (MetaModel::EnumStimuli($sClass) as $sStimulusCode => $oStimulus)
|
||||||
{
|
{
|
||||||
$bGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
$bGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
||||||
if ($bGrant === true)
|
if ($bGrant === true)
|
||||||
{
|
{
|
||||||
$aStimuli[] = '<span title="'.$sStimulusCode.': '.utils::EscapeHtml($oStimulus->GetDescription()).'">'.utils::EscapeHtml($oStimulus->GetLabel()).'</span>';
|
$aStimuli[] = '<span title="'.$sStimulusCode.': '.htmlentities($oStimulus->GetDescription(), ENT_QUOTES, 'UTF-8').'">'.htmlentities($oStimulus->GetLabel(), ENT_QUOTES, 'UTF-8').'</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sStimuli = implode(', ', $aStimuli);
|
$sStimuli = implode(', ', $aStimuli);
|
||||||
@@ -159,9 +180,11 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
||||||
{
|
{
|
||||||
parent::DisplayBareRelations($oPage, $bEditMode);
|
parent::DisplayBareRelations($oPage, $bEditMode);
|
||||||
|
if (!$bEditMode)
|
||||||
$oPage->SetCurrentTab('UI:UserManagement:GrantMatrix');
|
{
|
||||||
$this->DoShowGrantSumary($oPage);
|
$oPage->SetCurrentTab(Dict::S('UI:UserManagement:GrantMatrix'));
|
||||||
|
$this->DoShowGrantSumary($oPage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function GetReadOnlyAttributes()
|
public static function GetReadOnlyAttributes()
|
||||||
@@ -180,12 +203,6 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
// preserve DB integrity by deleting links to users
|
// preserve DB integrity by deleting links to users
|
||||||
protected function OnDelete()
|
protected function OnDelete()
|
||||||
{
|
{
|
||||||
// Don't remove admin profile
|
|
||||||
if ($this->Get('name') === ADMIN_PROFILE_NAME)
|
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: this may break the rule that says: "a user must have at least ONE profile" !
|
// Note: this may break the rule that says: "a user must have at least ONE profile" !
|
||||||
$oLnkSet = $this->Get('user_list');
|
$oLnkSet = $this->Get('user_list');
|
||||||
while($oLnk = $oLnkSet->Fetch())
|
while($oLnk = $oLnkSet->Fetch())
|
||||||
@@ -222,37 +239,25 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "addon/userrights,grant_by_profile,filter",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => array("userlogin", "profile"),
|
"name_attcode" => "userid",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => array(),
|
||||||
"db_table" => "priv_urp_userprofile",
|
"db_table" => "priv_urp_userprofile",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
"is_link" => true, /** @since 3.1.0 N°6482 */
|
"display_template" => "",
|
||||||
'uniqueness_rules' => array(
|
|
||||||
'no_duplicate' => array(
|
|
||||||
'attributes' => array(
|
|
||||||
0 => 'userid',
|
|
||||||
1 => 'profileid',
|
|
||||||
),
|
|
||||||
'filter' => '',
|
|
||||||
'disabled' => false,
|
|
||||||
'is_blocking' => true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login")));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid",
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
||||||
array("targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "allow_target_creation" => false)));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name")));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name")));
|
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details
|
||||||
@@ -262,107 +267,23 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetName()
|
||||||
|
{
|
||||||
|
return Dict::Format('UI:UserManagement:LinkBetween_User_And_Profile', $this->Get('userlogin'), $this->Get('profile'));
|
||||||
|
}
|
||||||
|
|
||||||
public function CheckToDelete(&$oDeletionPlan)
|
public function CheckToDelete(&$oDeletionPlan)
|
||||||
{
|
{
|
||||||
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
if (MetaModel::GetConfig()->Get('demo_mode'))
|
||||||
|
{
|
||||||
// Users deletion is NOT allowed in demo mode
|
// Users deletion is NOT allowed in demo mode
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
$oDeletionPlan->AddToDelete($this, null);
|
||||||
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
||||||
$oDeletionPlan->ComputeResults();
|
$oDeletionPlan->ComputeResults();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
|
||||||
}
|
|
||||||
catch (SecurityException $e) {
|
|
||||||
// Users deletion is NOT allowed
|
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
|
||||||
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
|
||||||
$oDeletionPlan->ComputeResults();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::CheckToDelete($oDeletionPlan);
|
return parent::CheckToDelete($oDeletionPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function DoCheckToDelete(&$oDeletionPlan)
|
|
||||||
{
|
|
||||||
if (MetaModel::GetConfig()->Get('demo_mode')) {
|
|
||||||
// Users deletion is NOT allowed in demo mode
|
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
|
||||||
$oDeletionPlan->SetDeletionIssues($this, array('deletion not allowed in demo mode.'), true);
|
|
||||||
$oDeletionPlan->ComputeResults();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_DELETE);
|
|
||||||
}
|
|
||||||
catch (SecurityException $e) {
|
|
||||||
// Users deletion is NOT allowed
|
|
||||||
$oDeletionPlan->AddToDelete($this, null);
|
|
||||||
$oDeletionPlan->SetDeletionIssues($this, [$e->getMessage()], true);
|
|
||||||
$oDeletionPlan->ComputeResults();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent::DoCheckToDelete($oDeletionPlan);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function OnInsert()
|
|
||||||
{
|
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_CREATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function OnUpdate()
|
|
||||||
{
|
|
||||||
$this->CheckIfProfileIsAllowed(UR_ACTION_MODIFY);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function OnDelete()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $iActionCode
|
|
||||||
*
|
|
||||||
* @throws \ArchivedObjectException
|
|
||||||
* @throws \CoreException
|
|
||||||
* @throws \SecurityException
|
|
||||||
*/
|
|
||||||
protected function CheckIfProfileIsAllowed($iActionCode)
|
|
||||||
{
|
|
||||||
// When initializing or admin, we need to let everything pass trough
|
|
||||||
if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; }
|
|
||||||
|
|
||||||
// Only administrators can manage administrators
|
|
||||||
$iOrigUserId = $this->GetOriginal('userid');
|
|
||||||
if (!empty($iOrigUserId))
|
|
||||||
{
|
|
||||||
$oUser = MetaModel::GetObject('User', $iOrigUserId, true, true);
|
|
||||||
if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator())
|
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$oUser = MetaModel::GetObject('User', $this->Get('userid'), true, true);
|
|
||||||
if (UserRights::IsAdministrator($oUser) && !UserRights::IsAdministrator())
|
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessRestricted'));
|
|
||||||
}
|
|
||||||
if (!UserRights::IsActionAllowed(get_class($this), $iActionCode, DBObjectSet::FromObject($this)))
|
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Error:ObjectCannotBeUpdated'));
|
|
||||||
}
|
|
||||||
if (!UserRights::IsAdministrator() && ($this->Get('profile') === ADMIN_PROFILE_NAME))
|
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('UI:Login:Error:AccessAdmin'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class URP_UserOrg extends UserRightsBaseClassGUI
|
class URP_UserOrg extends UserRightsBaseClassGUI
|
||||||
@@ -371,14 +292,15 @@ class URP_UserOrg extends UserRightsBaseClassGUI
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "addon/userrights,grant_by_profile",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => array("userlogin", "allowed_org_name"),
|
"name_attcode" => "userid",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => array(),
|
||||||
"db_table" => "priv_urp_userorg",
|
"db_table" => "priv_urp_userorg",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -398,39 +320,9 @@ class URP_UserOrg extends UserRightsBaseClassGUI
|
|||||||
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'allowed_org_id')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'allowed_org_id')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function OnInsert()
|
public function GetName()
|
||||||
{
|
{
|
||||||
$this->CheckIfOrgIsAllowed();
|
return Dict::Format('UI:UserManagement:LinkBetween_User_And_Org', $this->Get('userlogin'), $this->Get('allowed_org_name'));
|
||||||
}
|
|
||||||
|
|
||||||
protected function OnUpdate()
|
|
||||||
{
|
|
||||||
$this->CheckIfOrgIsAllowed();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function OnDelete()
|
|
||||||
{
|
|
||||||
$this->CheckIfOrgIsAllowed();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws \CoreException
|
|
||||||
*/
|
|
||||||
protected function CheckIfOrgIsAllowed()
|
|
||||||
{
|
|
||||||
if (!UserRights::IsLoggedIn() || UserRights::IsAdministrator()) { return; }
|
|
||||||
|
|
||||||
$oUser = UserRights::GetUserObject();
|
|
||||||
$oAddon = UserRights::GetModuleInstance();
|
|
||||||
$aOrgs = $oAddon->GetUserOrgs($oUser, '');
|
|
||||||
if (count($aOrgs) > 0)
|
|
||||||
{
|
|
||||||
$iOrigOrgId = $this->GetOriginal('allowed_org_id');
|
|
||||||
if ((!empty($iOrigOrgId) && !in_array($iOrigOrgId, $aOrgs)) || !in_array($this->Get('allowed_org_id'), $aOrgs))
|
|
||||||
{
|
|
||||||
throw new SecurityException(Dict::Format('Class:User/Error:OrganizationNotAllowed'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -448,36 +340,38 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
UR_ACTION_BULK_DELETE => 'bd',
|
UR_ACTION_BULK_DELETE => 'bd',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
|
|
||||||
* @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887
|
|
||||||
*/
|
|
||||||
private $aUsersProfilesList = [];
|
|
||||||
|
|
||||||
// Installation: create the very first user
|
// Installation: create the very first user
|
||||||
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
||||||
{
|
{
|
||||||
CMDBObject::SetCurrentChangeFromParams('Initialization create administrator');
|
CMDBObject::SetTrackInfo('Initialization');
|
||||||
|
|
||||||
|
$oChange = CMDBObject::GetCurrentChange();
|
||||||
|
|
||||||
$iContactId = 0;
|
$iContactId = 0;
|
||||||
// Support drastic data model changes: no organization class (or not writable)!
|
// Support drastic data model changes: no organization class (or not writable)!
|
||||||
if (MetaModel::IsValidClass('Organization') && !MetaModel::IsAbstract('Organization')) {
|
if (MetaModel::IsValidClass('Organization') && !MetaModel::IsAbstract('Organization'))
|
||||||
$oOrg = MetaModel::NewObject('Organization');
|
{
|
||||||
|
$oOrg = new Organization();
|
||||||
$oOrg->Set('name', 'My Company/Department');
|
$oOrg->Set('name', 'My Company/Department');
|
||||||
$oOrg->Set('code', 'SOMECODE');
|
$oOrg->Set('code', 'SOMECODE');
|
||||||
$iOrgId = $oOrg->DBInsertNoReload();
|
$iOrgId = $oOrg->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
|
|
||||||
// Support drastic data model changes: no Person class (or not writable)!
|
// Support drastic data model changes: no Person class (or not writable)!
|
||||||
if (MetaModel::IsValidClass('Person') && !MetaModel::IsAbstract('Person')) {
|
if (MetaModel::IsValidClass('Person') && !MetaModel::IsAbstract('Person'))
|
||||||
$oContact = MetaModel::NewObject('Person');
|
{
|
||||||
|
$oContact = new Person();
|
||||||
$oContact->Set('name', 'My last name');
|
$oContact->Set('name', 'My last name');
|
||||||
$oContact->Set('first_name', 'My first name');
|
$oContact->Set('first_name', 'My first name');
|
||||||
if (MetaModel::IsValidAttCode('Person', 'org_id'))
|
if (MetaModel::IsValidAttCode('Person', 'org_id'))
|
||||||
{
|
{
|
||||||
$oContact->Set('org_id', $iOrgId);
|
$oContact->Set('org_id', $iOrgId);
|
||||||
}
|
}
|
||||||
|
if (MetaModel::IsValidAttCode('Person', 'phone'))
|
||||||
|
{
|
||||||
|
$oContact->Set('phone', '+00 000 000 000');
|
||||||
|
}
|
||||||
$oContact->Set('email', 'my.email@foo.org');
|
$oContact->Set('email', 'my.email@foo.org');
|
||||||
$iContactId = $oContact->DBInsertNoReload();
|
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,12 +390,14 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
if (is_object($oAdminProfile))
|
if (is_object($oAdminProfile))
|
||||||
{
|
{
|
||||||
$oUserProfile = new URP_UserProfile();
|
$oUserProfile = new URP_UserProfile();
|
||||||
|
//$oUserProfile->Set('userid', $iUserId);
|
||||||
$oUserProfile->Set('profileid', $oAdminProfile->GetKey());
|
$oUserProfile->Set('profileid', $oAdminProfile->GetKey());
|
||||||
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
|
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
|
||||||
|
//$oUserProfile->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
$oSet = DBObjectSet::FromObject($oUserProfile);
|
$oSet = DBObjectSet::FromObject($oUserProfile);
|
||||||
$oUser->Set('profile_list', $oSet);
|
$oUser->Set('profile_list', $oSet);
|
||||||
}
|
}
|
||||||
$iUserId = $oUser->DBInsertNoReload();
|
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,8 +405,13 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected $m_aAdmins = array(); // id -> bool, true if the user has the well-known admin profile
|
||||||
|
protected $m_aPortalUsers = array(); // id -> bool, true if the user has the well-known portal user profile
|
||||||
|
|
||||||
|
protected $m_aProfiles; // id -> object
|
||||||
|
protected $m_aUserProfiles = array(); // userid,profileid -> object
|
||||||
protected $m_aUserOrgs = array(); // userid -> array of orgid
|
protected $m_aUserOrgs = array(); // userid -> array of orgid
|
||||||
protected $m_aAdministrators = null; // [user id]
|
|
||||||
|
|
||||||
// Built on demand, could be optimized if necessary (doing a query for each attribute that needs to be read)
|
// Built on demand, could be optimized if necessary (doing a query for each attribute that needs to be read)
|
||||||
protected $m_aObjectActionGrants = array();
|
protected $m_aObjectActionGrants = array();
|
||||||
@@ -518,14 +419,10 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
/**
|
/**
|
||||||
* Read and cache organizations allowed to the given user
|
* Read and cache organizations allowed to the given user
|
||||||
*
|
*
|
||||||
* @param $oUser
|
* @param oUser
|
||||||
* @param $sClass (not used here but can be used in overloads)
|
* @param sClass -not used here but can be used in overloads
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws \CoreException
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
*/
|
||||||
public function GetUserOrgs($oUser, $sClass)
|
protected function GetUserOrgs($oUser, $sClass)
|
||||||
{
|
{
|
||||||
$iUser = $oUser->GetKey();
|
$iUser = $oUser->GetKey();
|
||||||
if (!array_key_exists($iUser, $this->m_aUserOrgs))
|
if (!array_key_exists($iUser, $this->m_aUserOrgs))
|
||||||
@@ -539,6 +436,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), array(), array('userid' => $iUser));
|
$oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), array(), array('userid' => $iUser));
|
||||||
while ($aRow = $oUserOrgSet->FetchAssoc())
|
while ($aRow = $oUserOrgSet->FetchAssoc())
|
||||||
{
|
{
|
||||||
|
$oUserOrg = $aRow['UserOrg'];
|
||||||
$oOrg = $aRow['Org'];
|
$oOrg = $aRow['Org'];
|
||||||
$this->m_aUserOrgs[$iUser][] = $oOrg->GetKey();
|
$this->m_aUserOrgs[$iUser][] = $oOrg->GetKey();
|
||||||
}
|
}
|
||||||
@@ -560,185 +458,144 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
return $this->m_aUserOrgs[$iUser];
|
return $this->m_aUserOrgs[$iUser];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read and cache profiles of the given user
|
||||||
|
*/
|
||||||
|
protected function GetUserProfiles($iUser)
|
||||||
|
{
|
||||||
|
if (!array_key_exists($iUser, $this->m_aUserProfiles))
|
||||||
|
{
|
||||||
|
$oSearch = new DBObjectSearch('URP_UserProfile');
|
||||||
|
$oSearch->AllowAllData();
|
||||||
|
$oCondition = new BinaryExpression(new FieldExpression('userid'), '=', new VariableExpression('userid'));
|
||||||
|
$oSearch->AddConditionExpression($oCondition);
|
||||||
|
|
||||||
|
$this->m_aUserProfiles[$iUser] = array();
|
||||||
|
$oUserProfileSet = new DBObjectSet($oSearch, array(), array('userid' => $iUser));
|
||||||
|
while ($oUserProfile = $oUserProfileSet->Fetch())
|
||||||
|
{
|
||||||
|
$this->m_aUserProfiles[$iUser][$oUserProfile->Get('profileid')] = $oUserProfile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->m_aUserProfiles[$iUser];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function ResetCache()
|
public function ResetCache()
|
||||||
{
|
{
|
||||||
// Loaded by Load cache
|
// Loaded by Load cache
|
||||||
|
$this->m_aProfiles = null;
|
||||||
|
$this->m_aUserProfiles = array();
|
||||||
$this->m_aUserOrgs = array();
|
$this->m_aUserOrgs = array();
|
||||||
|
|
||||||
|
$this->m_aAdmins = array();
|
||||||
|
$this->m_aPortalUsers = array();
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
$this->m_aObjectActionGrants = array();
|
$this->m_aObjectActionGrants = array();
|
||||||
$this->m_aAdministrators = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function LoadCache()
|
public function LoadCache()
|
||||||
{
|
{
|
||||||
static $bSharedObjectInitialized = false;
|
if (!is_null($this->m_aProfiles)) return;
|
||||||
if (!$bSharedObjectInitialized)
|
// Could be loaded in a shared memory (?)
|
||||||
|
|
||||||
|
$oKPI = new ExecutionKPI();
|
||||||
|
|
||||||
|
if (self::HasSharing())
|
||||||
{
|
{
|
||||||
$bSharedObjectInitialized = true;
|
SharedObject::InitSharedClassProperties();
|
||||||
if (self::HasSharing())
|
|
||||||
{
|
|
||||||
SharedObject::InitSharedClassProperties();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$oProfileSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData("SELECT URP_Profiles"));
|
||||||
|
$this->m_aProfiles = array();
|
||||||
|
while ($oProfile = $oProfileSet->Fetch())
|
||||||
|
{
|
||||||
|
$this->m_aProfiles[$oProfile->GetKey()] = $oProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oKPI->ComputeAndReport('Load of user management cache (excepted Action Grants)');
|
||||||
|
|
||||||
|
/*
|
||||||
|
echo "<pre>\n";
|
||||||
|
print_r($this->m_aProfiles);
|
||||||
|
print_r($this->m_aUserProfiles);
|
||||||
|
print_r($this->m_aUserOrgs);
|
||||||
|
echo "</pre>\n";
|
||||||
|
exit;
|
||||||
|
*/
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $oUser User
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function IsAdministrator($oUser)
|
public function IsAdministrator($oUser)
|
||||||
{
|
{
|
||||||
// UserRights caches the list for us
|
//$this->LoadCache();
|
||||||
return UserRights::HasProfile(ADMIN_PROFILE_NAME, $oUser);
|
$iUser = $oUser->GetKey();
|
||||||
|
if (!array_key_exists($iUser, $this->m_aAdmins))
|
||||||
|
{
|
||||||
|
$bIsAdmin = false;
|
||||||
|
foreach($this->GetUserProfiles($iUser) as $oUserProfile)
|
||||||
|
{
|
||||||
|
if ($oUserProfile->Get('profile') == ADMIN_PROFILE_NAME)
|
||||||
|
{
|
||||||
|
$bIsAdmin = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->m_aAdmins[$iUser] = $bIsAdmin;
|
||||||
|
}
|
||||||
|
return $this->m_aAdmins[$iUser];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $oUser User
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function IsPortalUser($oUser)
|
public function IsPortalUser($oUser)
|
||||||
{
|
{
|
||||||
// UserRights caches the list for us
|
//$this->LoadCache();
|
||||||
return UserRights::HasProfile(PORTAL_PROFILE_NAME, $oUser);
|
$iUser = $oUser->GetKey();
|
||||||
}
|
if (!array_key_exists($iUser, $this->m_aPortalUsers))
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $oUser User
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
* @throws \ArchivedObjectException
|
|
||||||
* @throws \CoreException
|
|
||||||
* @throws \CoreUnexpectedValue
|
|
||||||
* @throws \MySQLException
|
|
||||||
*/
|
|
||||||
public function ListProfiles($oUser)
|
|
||||||
{
|
|
||||||
$aRet = array();
|
|
||||||
$oSearch = new DBObjectSearch('URP_UserProfile');
|
|
||||||
$oSearch->AllowAllData();
|
|
||||||
$oSearch->NoContextParameters();
|
|
||||||
$oSearch->Addcondition('userid', $oUser->GetKey(), '=');
|
|
||||||
$oProfiles = new DBObjectSet($oSearch);
|
|
||||||
while ($oUserProfile = $oProfiles->Fetch())
|
|
||||||
{
|
{
|
||||||
$aRet[$oUserProfile->Get('profileid')] = $oUserProfile->Get('profileid_friendlyname');
|
$bIsPortalUser = false;
|
||||||
|
foreach($this->GetUserProfiles($iUser) as $oUserProfile)
|
||||||
|
{
|
||||||
|
if ($oUserProfile->Get('profile') == PORTAL_PROFILE_NAME)
|
||||||
|
{
|
||||||
|
$bIsPortalUser = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return $aRet;
|
}
|
||||||
|
$this->m_aPortalUsers[$iUser] = $bIsPortalUser;
|
||||||
|
}
|
||||||
|
return $this->m_aPortalUsers[$iUser];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetSelectFilter($oUser, $sClass, $aSettings = array())
|
public function GetSelectFilter($oUser, $sClass, $aSettings = array())
|
||||||
{
|
{
|
||||||
$this->LoadCache();
|
$this->LoadCache();
|
||||||
|
|
||||||
// Let us pass an administrator for bypassing the grant matrix check in order to test this method without the need to set up a complex profile
|
$aObjectPermissions = $this->GetUserActionGrant($oUser, $sClass, UR_ACTION_READ);
|
||||||
// In the nominal case Administrators never end up here (since they completely bypass GetSelectFilter)
|
if ($aObjectPermissions['permission'] == UR_ALLOWED_NO)
|
||||||
if (!static::IsAdministrator($oUser) && (MetaModel::HasCategory($sClass, 'silo') || MetaModel::HasCategory($sClass, 'bizmodel')))
|
|
||||||
{
|
{
|
||||||
// N°4354 - Categories 'silo' and 'bizmodel' do check the grant matrix. Whereas 'filter' always allows to read (but the result can be filtered)
|
return false;
|
||||||
$aObjectPermissions = $this->GetUserActionGrant($oUser, $sClass, UR_ACTION_READ);
|
|
||||||
if ($aObjectPermissions['permission'] == UR_ALLOWED_NO)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$oFilter = true;
|
// Determine how to position the objects of this class
|
||||||
$aConditions = array();
|
//
|
||||||
|
$sAttCode = self::GetOwnerOrganizationAttCode($sClass);
|
||||||
// Determine if this class is part of a silo and build the filter for it
|
if (is_null($sAttCode))
|
||||||
$sAttCode = UserRights::GetOwnerOrganizationAttCode($sClass);
|
|
||||||
if (!is_null($sAttCode))
|
|
||||||
{
|
{
|
||||||
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
// No filtering for this object
|
||||||
if (count($aUserOrgs) > 0)
|
return true;
|
||||||
{
|
|
||||||
$oFilter = $this->MakeSelectFilter($sClass, $aUserOrgs, $aSettings, $sAttCode);
|
|
||||||
}
|
|
||||||
// else: No org means 'any org'
|
|
||||||
}
|
}
|
||||||
// else: No silo for this class
|
// Position the user
|
||||||
|
//
|
||||||
// Specific conditions to hide, for non-administrators, the Administrator Users, the Administrator Profile and related links
|
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
||||||
// Note: when logged as an administrator, GetSelectFilter is completely bypassed.
|
if (count($aUserOrgs) == 0)
|
||||||
if ($this->AdministratorsAreHidden())
|
|
||||||
{
|
{
|
||||||
if ($sClass == 'URP_Profiles')
|
// No org means 'any org'
|
||||||
{
|
return true;
|
||||||
$oExpression = new FieldExpression('id', $sClass);
|
|
||||||
$oScalarExpr = new ScalarExpression(1);
|
|
||||||
|
|
||||||
$aConditions[] = new BinaryExpression($oExpression, '!=', $oScalarExpr);
|
|
||||||
}
|
|
||||||
else if (($sClass == 'URP_UserProfile') || ($sClass == 'User') || (is_subclass_of($sClass, 'User')))
|
|
||||||
{
|
|
||||||
$aAdministrators = $this->GetAdministrators();
|
|
||||||
if (count($aAdministrators) > 0)
|
|
||||||
{
|
|
||||||
$sAttCode = ($sClass == 'URP_UserProfile') ? 'userid' : 'id';
|
|
||||||
$oExpression = new FieldExpression($sAttCode, $sClass);
|
|
||||||
$oListExpr = ListExpression::FromScalars($aAdministrators);
|
|
||||||
$aConditions[] = new BinaryExpression($oExpression, 'NOT IN', $oListExpr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handling of the added conditions
|
return $this->MakeSelectFilter($sClass, $aUserOrgs, $aSettings, $sAttCode);
|
||||||
if (count($aConditions) > 0)
|
|
||||||
{
|
|
||||||
if($oFilter === true)
|
|
||||||
{
|
|
||||||
// No 'silo' filter, let's build a clean one
|
|
||||||
$oFilter = new DBObjectSearch($sClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add the conditions to the filter
|
|
||||||
foreach($aConditions as $oCondition)
|
|
||||||
{
|
|
||||||
$oFilter->AddConditionExpression($oCondition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $oFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve (and memoize) the list of administrator accounts.
|
|
||||||
* Note that there should always be at least one administrator account
|
|
||||||
* @return number[]
|
|
||||||
*/
|
|
||||||
private function GetAdministrators()
|
|
||||||
{
|
|
||||||
if ($this->m_aAdministrators === null)
|
|
||||||
{
|
|
||||||
// Find all administrators
|
|
||||||
$this->m_aAdministrators = array();
|
|
||||||
$oAdministratorsFilter = new DBObjectSearch('User');
|
|
||||||
$oLnkFilter = new DBObjectSearch('URP_UserProfile');
|
|
||||||
$oExpression = new FieldExpression('profileid', 'URP_UserProfile');
|
|
||||||
$oScalarExpr = new ScalarExpression(1);
|
|
||||||
$oCondition = new BinaryExpression($oExpression, '=', $oScalarExpr);
|
|
||||||
$oLnkFilter->AddConditionExpression($oCondition);
|
|
||||||
$oAdministratorsFilter->AddCondition_ReferencedBy($oLnkFilter, 'userid');
|
|
||||||
$oAdministratorsFilter->AllowAllData(true); // Mandatory to prevent infinite recursion !!
|
|
||||||
$oSet = new DBObjectSet($oAdministratorsFilter);
|
|
||||||
$oSet->OptimizeColumnLoad(array('User' => array('login')));
|
|
||||||
while($oUser = $oSet->Fetch())
|
|
||||||
{
|
|
||||||
$this->m_aAdministrators[] = $oUser->GetKey();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this->m_aAdministrators;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether or not to hide the 'Administrator' profile and the administrator accounts
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
private function AdministratorsAreHidden()
|
|
||||||
{
|
|
||||||
return ((bool)MetaModel::GetConfig()->Get('security.hide_administrators'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -758,20 +615,14 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
// load and cache permissions for the current user on the given class
|
// load and cache permissions for the current user on the given class
|
||||||
//
|
//
|
||||||
$iUser = $oUser->GetKey();
|
$iUser = $oUser->GetKey();
|
||||||
if (isset($this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode])){
|
$aTest = @$this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode];
|
||||||
$aTest = $this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode];
|
if (is_array($aTest)) return $aTest;
|
||||||
if (is_array($aTest)) return $aTest;
|
|
||||||
}
|
|
||||||
|
|
||||||
$sAction = self::$m_aActionCodes[$iActionCode];
|
$sAction = self::$m_aActionCodes[$iActionCode];
|
||||||
|
|
||||||
$bStatus = null;
|
$bStatus = null;
|
||||||
// Cache user's profiles
|
$aAttributes = array();
|
||||||
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
|
foreach($this->GetUserProfiles($iUser) as $iProfile => $oProfile)
|
||||||
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
|
||||||
}
|
|
||||||
// Call the API of UserRights because it caches the list for us
|
|
||||||
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
|
||||||
{
|
{
|
||||||
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
|
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
|
||||||
if (!is_null($bGrant))
|
if (!is_null($bGrant))
|
||||||
@@ -794,6 +645,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
|
|
||||||
$aRes = array(
|
$aRes = array(
|
||||||
'permission' => $iPermission,
|
'permission' => $iPermission,
|
||||||
|
// 'attributes' => $aAttributes,
|
||||||
);
|
);
|
||||||
$this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode] = $aRes;
|
$this->m_aObjectActionGrants[$iUser][$sClass][$iActionCode] = $aRes;
|
||||||
return $aRes;
|
return $aRes;
|
||||||
@@ -834,7 +686,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
// But currently we are checking wether the objects might be written...
|
// But currently we are checking wether the objects might be written...
|
||||||
// Let's exclude the objects based on the relevant criteria
|
// Let's exclude the objects based on the relevant criteria
|
||||||
|
|
||||||
$sOrgAttCode = UserRights::GetOwnerOrganizationAttCode($sClass);
|
$sOrgAttCode = self::GetOwnerOrganizationAttCode($sClass);
|
||||||
if (!is_null($sOrgAttCode))
|
if (!is_null($sOrgAttCode))
|
||||||
{
|
{
|
||||||
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
||||||
@@ -897,16 +749,10 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
// Note: this code is VERY close to the code of IsActionAllowed()
|
// Note: this code is VERY close to the code of IsActionAllowed()
|
||||||
$iUser = $oUser->GetKey();
|
$iUser = $oUser->GetKey();
|
||||||
|
|
||||||
// Cache user's profiles
|
|
||||||
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
|
|
||||||
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: The object set is ignored because it was interesting to optimize for huge data sets
|
// Note: The object set is ignored because it was interesting to optimize for huge data sets
|
||||||
// and acceptable to consider only the root class of the object set
|
// and acceptable to consider only the root class of the object set
|
||||||
$bStatus = null;
|
$bStatus = null;
|
||||||
// Call the API of UserRights because it caches the list for us
|
foreach($this->GetUserProfiles($iUser) as $iProfile => $oProfile)
|
||||||
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
|
||||||
{
|
{
|
||||||
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
|
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
|
||||||
if (!is_null($bGrant))
|
if (!is_null($bGrant))
|
||||||
@@ -935,14 +781,33 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sClass
|
* Find out which attribute is corresponding the the dimension 'owner org'
|
||||||
* @return string|null Find out which attribute is corresponding the dimension 'owner org'
|
* returns null if no such attribute has been found (no filtering should occur)
|
||||||
* returns null if no such attribute has been found (no filtering should occur)
|
|
||||||
* @deprecated 3.3.0 use @UserRights::GetOwnerOrganizationAttCode instead
|
|
||||||
*/
|
*/
|
||||||
public static function GetOwnerOrganizationAttCode($sClass)
|
public static function GetOwnerOrganizationAttCode($sClass)
|
||||||
{
|
{
|
||||||
return UserRights::GetOwnerOrganizationAttCode($sClass);
|
$sAttCode = null;
|
||||||
|
|
||||||
|
$aCallSpec = array($sClass, 'MapContextParam');
|
||||||
|
if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization'))
|
||||||
|
{
|
||||||
|
$sAttCode = 'id';
|
||||||
|
}
|
||||||
|
elseif (is_callable($aCallSpec))
|
||||||
|
{
|
||||||
|
$sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter
|
||||||
|
if (!MetaModel::IsValidAttCode($sClass, $sAttCode))
|
||||||
|
{
|
||||||
|
// Skip silently. The data model checker will tell you something about this...
|
||||||
|
$sAttCode = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(MetaModel::IsValidAttCode($sClass, 'org_id'))
|
||||||
|
{
|
||||||
|
$sAttCode = 'org_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sAttCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
// Copyright (C) 2010-2013 Combodo SARL
|
||||||
* Copyright (C) 2013-2024 Combodo SAS
|
//
|
||||||
*
|
// This file is part of iTop.
|
||||||
* This file is part of iTop.
|
//
|
||||||
*
|
// iTop is free software; you can redistribute it and/or modify
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
// (at your option) any later version.
|
||||||
* (at your option) any later version.
|
//
|
||||||
*
|
// iTop is distributed in the hope that it will be useful,
|
||||||
* iTop is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU Affero General Public License for more details.
|
||||||
* GNU Affero General Public License for more details.
|
//
|
||||||
*
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
|
||||||
|
|
||||||
use Combodo\iTop\Application\WebPage\WebPage;
|
/**
|
||||||
|
* UserRightsProfile
|
||||||
|
* User management Module, basing the right on profiles and a matrix (similar to UserRightsMatrix, but profiles and other decorations have been added)
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
*/
|
||||||
|
|
||||||
define('ADMIN_PROFILE_NAME', 'Administrator');
|
define('ADMIN_PROFILE_NAME', 'Administrator');
|
||||||
define('PORTAL_PROFILE_NAME', 'Portal user');
|
define('PORTAL_PROFILE_NAME', 'Portal user');
|
||||||
@@ -71,15 +76,15 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "addon/userrights",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"complementary_name_attcode" => array('description'),
|
"state_attcode" => "",
|
||||||
"state_attcode" => "",
|
"reconc_keys" => array(),
|
||||||
"reconc_keys" => array(),
|
"db_table" => "priv_urp_profiles",
|
||||||
"db_table" => "priv_urp_profiles",
|
"db_key_field" => "id",
|
||||||
"db_key_field" => "id",
|
"db_finalclass_field" => "",
|
||||||
"db_finalclass_field" => "",
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -92,8 +97,8 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('name', 'description')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array ('name', 'description'));
|
MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $m_bCheckReservedNames = true;
|
protected $m_bCheckReservedNames = true;
|
||||||
@@ -282,7 +287,7 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
$oGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
$oGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
||||||
if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes'))
|
if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes'))
|
||||||
{
|
{
|
||||||
$aStimuli[] = '<span title="'.$sStimulusCode.': '.utils::EscapeHtml($oStimulus->GetDescription()).'">'.utils::EscapeHtml($oStimulus->GetLabel()).'</span>';
|
$aStimuli[] = '<span title="'.$sStimulusCode.': '.htmlentities($oStimulus->GetDescription(), ENT_QUOTES, 'UTF-8').'">'.htmlentities($oStimulus->GetLabel(), ENT_QUOTES, 'UTF-8').'</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sStimuli = implode(', ', $aStimuli);
|
$sStimuli = implode(', ', $aStimuli);
|
||||||
@@ -314,9 +319,11 @@ class URP_Profiles extends UserRightsBaseClassGUI
|
|||||||
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
||||||
{
|
{
|
||||||
parent::DisplayBareRelations($oPage, $bEditMode);
|
parent::DisplayBareRelations($oPage, $bEditMode);
|
||||||
|
if (!$bEditMode)
|
||||||
$oPage->SetCurrentTab('UI:UserManagement:GrantMatrix');
|
{
|
||||||
$this->DoShowGrantSumary($oPage);
|
$oPage->SetCurrentTab(Dict::S('UI:UserManagement:GrantMatrix'));
|
||||||
|
$this->DoShowGrantSumary($oPage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,26 +335,25 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "addon/userrights",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => array("userlogin", "profile"),
|
"name_attcode" => "userid",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => array(),
|
||||||
"db_table" => "priv_urp_userprofile",
|
"db_table" => "priv_urp_userprofile",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
"is_link" => true, /** @since 3.1.0 N°6482 */
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login")));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid",
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
||||||
array("targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "allow_target_creation" => false)));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name")));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name")));
|
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details
|
||||||
@@ -356,6 +362,11 @@ class URP_UserProfile extends UserRightsBaseClassGUI
|
|||||||
MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetName()
|
||||||
|
{
|
||||||
|
return Dict::Format('UI:UserManagement:LinkBetween_User_And_Profile', $this->Get('userlogin'), $this->Get('profile'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class URP_UserOrg extends UserRightsBaseClassGUI
|
class URP_UserOrg extends UserRightsBaseClassGUI
|
||||||
@@ -366,12 +377,13 @@ class URP_UserOrg extends UserRightsBaseClassGUI
|
|||||||
(
|
(
|
||||||
"category" => "addon/userrights",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => array("userlogin", "allowed_org_name"),
|
"name_attcode" => "userid",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => array(),
|
||||||
"db_table" => "priv_urp_userorg",
|
"db_table" => "priv_urp_userorg",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -390,6 +402,11 @@ class URP_UserOrg extends UserRightsBaseClassGUI
|
|||||||
MetaModel::Init_SetZListItems('standard_search', array('userid', 'allowed_org_id')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('userid', 'allowed_org_id')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'allowed_org_id')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'allowed_org_id')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetName()
|
||||||
|
{
|
||||||
|
return Dict::Format('UI:UserManagement:LinkBetween_User_And_Org', $this->Get('userlogin'), $this->Get('allowed_org_name'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -407,6 +424,7 @@ class URP_ActionGrant extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_grant_actions",
|
"db_table" => "priv_urp_grant_actions",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -443,6 +461,7 @@ class URP_StimulusGrant extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_grant_stimulus",
|
"db_table" => "priv_urp_grant_stimulus",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -479,6 +498,7 @@ class URP_AttributeGrant extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_grant_attributes",
|
"db_table" => "priv_urp_grant_attributes",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -513,27 +533,36 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
||||||
{
|
{
|
||||||
// Create a change to record the history of the User object
|
// Create a change to record the history of the User object
|
||||||
CMDBObject::SetCurrentChangeFromParams('Initialization : create first user admin profile');
|
$oChange = MetaModel::NewObject("CMDBChange");
|
||||||
|
$oChange->Set("date", time());
|
||||||
|
$oChange->Set("userinfo", "Initialization");
|
||||||
|
$iChangeId = $oChange->DBInsert();
|
||||||
|
|
||||||
$iContactId = 0;
|
$iContactId = 0;
|
||||||
// Support drastic data model changes: no organization class (or not writable)!
|
// Support drastic data model changes: no organization class (or not writable)!
|
||||||
if (MetaModel::IsValidClass('Organization') && !MetaModel::IsAbstract('Organization')) {
|
if (MetaModel::IsValidClass('Organization') && !MetaModel::IsAbstract('Organization'))
|
||||||
$oOrg = MetaModel::NewObject('Organization');
|
{
|
||||||
|
$oOrg = new Organization();
|
||||||
$oOrg->Set('name', 'My Company/Department');
|
$oOrg->Set('name', 'My Company/Department');
|
||||||
$oOrg->Set('code', 'SOMECODE');
|
$oOrg->Set('code', 'SOMECODE');
|
||||||
$iOrgId = $oOrg->DBInsertNoReload();
|
$iOrgId = $oOrg->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
|
|
||||||
// Support drastic data model changes: no Person class (or not writable)!
|
// Support drastic data model changes: no Person class (or not writable)!
|
||||||
if (MetaModel::IsValidClass('Person') && !MetaModel::IsAbstract('Person')) {
|
if (MetaModel::IsValidClass('Person') && !MetaModel::IsAbstract('Person'))
|
||||||
$oContact = MetaModel::NewObject('Person');
|
{
|
||||||
|
$oContact = new Person();
|
||||||
$oContact->Set('name', 'My last name');
|
$oContact->Set('name', 'My last name');
|
||||||
$oContact->Set('first_name', 'My first name');
|
$oContact->Set('first_name', 'My first name');
|
||||||
if (MetaModel::IsValidAttCode('Person', 'org_id'))
|
if (MetaModel::IsValidAttCode('Person', 'org_id'))
|
||||||
{
|
{
|
||||||
$oContact->Set('org_id', $iOrgId);
|
$oContact->Set('org_id', $iOrgId);
|
||||||
}
|
}
|
||||||
|
if (MetaModel::IsValidAttCode('Person', 'phone'))
|
||||||
|
{
|
||||||
|
$oContact->Set('phone', '+00 000 000 000');
|
||||||
|
}
|
||||||
$oContact->Set('email', 'my.email@foo.org');
|
$oContact->Set('email', 'my.email@foo.org');
|
||||||
$iContactId = $oContact->DBInsertNoReload();
|
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,22 +570,25 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$oUser = new UserLocal();
|
$oUser = new UserLocal();
|
||||||
$oUser->Set('login', $sAdminUser);
|
$oUser->Set('login', $sAdminUser);
|
||||||
$oUser->Set('password', $sAdminPwd);
|
$oUser->Set('password', $sAdminPwd);
|
||||||
if (MetaModel::IsValidAttCode('UserLocal', 'contactid') && ($iContactId != 0)) {
|
if (MetaModel::IsValidAttCode('UserLocal', 'contactid') && ($iContactId != 0))
|
||||||
|
{
|
||||||
$oUser->Set('contactid', $iContactId);
|
$oUser->Set('contactid', $iContactId);
|
||||||
}
|
}
|
||||||
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
||||||
|
|
||||||
// Add this user to the very specific 'admin' profile
|
// Add this user to the very specific 'admin' profile
|
||||||
$oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => ADMIN_PROFILE_NAME), true /*all data*/);
|
$oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => ADMIN_PROFILE_NAME), true /*all data*/);
|
||||||
if (is_object($oAdminProfile)) {
|
if (is_object($oAdminProfile))
|
||||||
|
{
|
||||||
$oUserProfile = new URP_UserProfile();
|
$oUserProfile = new URP_UserProfile();
|
||||||
|
//$oUserProfile->Set('userid', $iUserId);
|
||||||
$oUserProfile->Set('profileid', $oAdminProfile->GetKey());
|
$oUserProfile->Set('profileid', $oAdminProfile->GetKey());
|
||||||
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
|
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
|
||||||
|
//$oUserProfile->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
$oSet = DBObjectSet::FromObject($oUserProfile);
|
$oSet = DBObjectSet::FromObject($oUserProfile);
|
||||||
$oUser->Set('profile_list', $oSet);
|
$oUser->Set('profile_list', $oSet);
|
||||||
}
|
}
|
||||||
$oUser->DBInsertNoReload();
|
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,14 +614,10 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
/**
|
/**
|
||||||
* Read and cache organizations allowed to the given user
|
* Read and cache organizations allowed to the given user
|
||||||
*
|
*
|
||||||
* @param User $oUser
|
* @param oUser
|
||||||
* @param string $sClass (not used here but can be used in overloads)
|
* @param sClass -not used here but can be used in overloads
|
||||||
*
|
|
||||||
* @return array keys of the User allowed org
|
|
||||||
* @throws \CoreException
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
*/
|
||||||
public function GetUserOrgs($oUser, $sClass)
|
protected function GetUserOrgs($oUser, $sClass)
|
||||||
{
|
{
|
||||||
$iUser = $oUser->GetKey();
|
$iUser = $oUser->GetKey();
|
||||||
if (!array_key_exists($iUser, $this->m_aUserOrgs))
|
if (!array_key_exists($iUser, $this->m_aUserOrgs))
|
||||||
@@ -603,6 +631,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
$oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), array(), array('userid' => $iUser));
|
$oUserOrgSet = new DBObjectSet(DBObjectSearch::FromOQL_AllData($sUserOrgQuery), array(), array('userid' => $iUser));
|
||||||
while ($aRow = $oUserOrgSet->FetchAssoc())
|
while ($aRow = $oUserOrgSet->FetchAssoc())
|
||||||
{
|
{
|
||||||
|
$oUserOrg = $aRow['UserOrg'];
|
||||||
$oOrg = $aRow['Org'];
|
$oOrg = $aRow['Org'];
|
||||||
$this->m_aUserOrgs[$iUser][] = $oOrg->GetKey();
|
$this->m_aUserOrgs[$iUser][] = $oOrg->GetKey();
|
||||||
}
|
}
|
||||||
@@ -685,7 +714,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
|||||||
|
|
||||||
public function LoadCache()
|
public function LoadCache()
|
||||||
{
|
{
|
||||||
if (!is_null($this->m_aProfiles)) return false;
|
if (!is_null($this->m_aProfiles)) return;
|
||||||
// Could be loaded in a shared memory (?)
|
// Could be loaded in a shared memory (?)
|
||||||
|
|
||||||
$oKPI = new ExecutionKPI();
|
$oKPI = new ExecutionKPI();
|
||||||
@@ -778,7 +807,7 @@ exit;
|
|||||||
|
|
||||||
// Determine how to position the objects of this class
|
// Determine how to position the objects of this class
|
||||||
//
|
//
|
||||||
$sAttCode = UserRights::GetOwnerOrganizationAttCode($sClass);
|
$sAttCode = self::GetOwnerOrganizationAttCode($sClass);
|
||||||
if (is_null($sAttCode))
|
if (is_null($sAttCode))
|
||||||
{
|
{
|
||||||
// No filtering for this object
|
// No filtering for this object
|
||||||
@@ -909,7 +938,7 @@ exit;
|
|||||||
// But currently we are checking wether the objects might be written...
|
// But currently we are checking wether the objects might be written...
|
||||||
// Let's exclude the objects based on the relevant criteria
|
// Let's exclude the objects based on the relevant criteria
|
||||||
|
|
||||||
$sOrgAttCode = UserRights::GetOwnerOrganizationAttCode($sClass);
|
$sOrgAttCode = self::GetOwnerOrganizationAttCode($sClass);
|
||||||
if (!is_null($sOrgAttCode))
|
if (!is_null($sOrgAttCode))
|
||||||
{
|
{
|
||||||
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
$aUserOrgs = $this->GetUserOrgs($oUser, $sClass);
|
||||||
@@ -1015,7 +1044,28 @@ exit;
|
|||||||
*/
|
*/
|
||||||
public static function GetOwnerOrganizationAttCode($sClass)
|
public static function GetOwnerOrganizationAttCode($sClass)
|
||||||
{
|
{
|
||||||
return UserRights::GetOwnerOrganizationAttCode($sClass);;
|
$sAttCode = null;
|
||||||
|
|
||||||
|
$aCallSpec = array($sClass, 'MapContextParam');
|
||||||
|
if (($sClass == 'Organization') || is_subclass_of($sClass, 'Organization'))
|
||||||
|
{
|
||||||
|
$sAttCode = 'id';
|
||||||
|
}
|
||||||
|
elseif (is_callable($aCallSpec))
|
||||||
|
{
|
||||||
|
$sAttCode = call_user_func($aCallSpec, 'org_id'); // Returns null when there is no mapping for this parameter
|
||||||
|
if (!MetaModel::IsValidAttCode($sClass, $sAttCode))
|
||||||
|
{
|
||||||
|
// Skip silently. The data model checker will tell you something about this...
|
||||||
|
$sAttCode = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif(MetaModel::IsValidAttCode($sClass, 'org_id'))
|
||||||
|
{
|
||||||
|
$sAttCode = 'org_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sAttCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,23 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
* Copyright (C) 2013-2024 Combodo SAS
|
//
|
||||||
*
|
// This file is part of iTop.
|
||||||
* This file is part of iTop.
|
//
|
||||||
*
|
// iTop is free software; you can redistribute it and/or modify
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
// (at your option) any later version.
|
||||||
* (at your option) any later version.
|
//
|
||||||
*
|
// iTop is distributed in the hope that it will be useful,
|
||||||
* iTop is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU Affero General Public License for more details.
|
||||||
* GNU Affero General Public License for more details.
|
//
|
||||||
*
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
*/
|
|
||||||
|
|
||||||
use Combodo\iTop\Application\WebPage\WebPage;
|
/**
|
||||||
|
* UserRightsProjection
|
||||||
|
* User management Module, basing the right on profiles and a matrix (similar to UserRightsProfile, but enhanced with dimensions and projection of classes and profile over the dimensions)
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
|
*/
|
||||||
|
|
||||||
define('ADMIN_PROFILE_ID', 1);
|
define('ADMIN_PROFILE_ID', 1);
|
||||||
|
|
||||||
@@ -52,15 +57,15 @@ class URP_Profiles extends UserRightsBaseClass
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "addon/userrights",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"complementary_name_attcode" => array('description'),
|
"state_attcode" => "",
|
||||||
"state_attcode" => "",
|
"reconc_keys" => array(),
|
||||||
"reconc_keys" => array(),
|
"db_table" => "priv_urp_profiles",
|
||||||
"db_table" => "priv_urp_profiles",
|
"db_key_field" => "id",
|
||||||
"db_key_field" => "id",
|
"db_finalclass_field" => "",
|
||||||
"db_finalclass_field" => "",
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -73,8 +78,8 @@ class URP_Profiles extends UserRightsBaseClass
|
|||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('name', 'description', 'user_list')); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', array('description')); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('name', 'description')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('name')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array ('name', 'description'));
|
MetaModel::Init_SetZListItems('advanced_search', array('name')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
function GetGrantAsHtml($oUserRights, $sClass, $sAction)
|
function GetGrantAsHtml($oUserRights, $sClass, $sAction)
|
||||||
@@ -114,7 +119,7 @@ class URP_Profiles extends UserRightsBaseClass
|
|||||||
$oGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
$oGrant = $oUserRights->GetClassStimulusGrant($this->GetKey(), $sClass, $sStimulusCode);
|
||||||
if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes'))
|
if (is_object($oGrant) && ($oGrant->Get('permission') == 'yes'))
|
||||||
{
|
{
|
||||||
$aStimuli[] = '<span title="'.$sStimulusCode.': '.utils::EscapeHtml($oStimulus->GetDescription()).'">'.utils::EscapeHtml($oStimulus->GetLabel()).'</span>';
|
$aStimuli[] = '<span title="'.$sStimulusCode.': '.htmlentities($oStimulus->GetDescription(), ENT_QUOTES, 'UTF-8').'">'.htmlentities($oStimulus->GetLabel(), ENT_QUOTES, 'UTF-8').'</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sStimuli = implode(', ', $aStimuli);
|
$sStimuli = implode(', ', $aStimuli);
|
||||||
@@ -146,9 +151,11 @@ class URP_Profiles extends UserRightsBaseClass
|
|||||||
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
function DisplayBareRelations(WebPage $oPage, $bEditMode = false)
|
||||||
{
|
{
|
||||||
parent::DisplayBareRelations($oPage, $bEditMode);
|
parent::DisplayBareRelations($oPage, $bEditMode);
|
||||||
|
if (!$bEditMode)
|
||||||
$oPage->SetCurrentTab('UI:UserManagement:GrantMatrix');
|
{
|
||||||
$this->DoShowGrantSumary($oPage);
|
$oPage->SetCurrentTab(Dict::S('UI:UserManagement:GrantMatrix'));
|
||||||
|
$this->DoShowGrantSumary($oPage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +174,7 @@ class URP_Dimensions extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_dimensions",
|
"db_table" => "priv_urp_dimensions",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -271,26 +279,25 @@ class URP_UserProfile extends UserRightsBaseClass
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "addon/userrights",
|
"category" => "addon/userrights",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => array("userlogin", "profile"),
|
"name_attcode" => "userid",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array(),
|
"reconc_keys" => array(),
|
||||||
"db_table" => "priv_urp_userprofile",
|
"db_table" => "priv_urp_userprofile",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
"is_link" => true, /** @since 3.1.0 N°6482 */
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass" => "User", "jointype" => "", "allowed_values" => null, "sql" => "userid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("userid", array("targetclass"=>"User", "jointype"=> "", "allowed_values"=>null, "sql"=>"userid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values" => null, "extkey_attcode" => 'userid', "target_attcode" => "login")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("userlogin", array("allowed_values"=>null, "extkey_attcode"=> 'userid', "target_attcode"=>"login")));
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid",
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("profileid", array("targetclass"=>"URP_Profiles", "jointype"=> "", "allowed_values"=>null, "sql"=>"profileid", "is_null_allowed"=>false, "on_target_delete"=>DEL_AUTO, "depends_on"=>array())));
|
||||||
array("targetclass" => "URP_Profiles", "jointype" => "", "allowed_values" => null, "sql" => "profileid", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "allow_target_creation" => false)));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values"=>null, "extkey_attcode"=> 'profileid', "target_attcode"=>"name")));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("profile", array("allowed_values" => null, "extkey_attcode" => 'profileid', "target_attcode" => "name")));
|
|
||||||
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("reason", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('userid', 'profileid', 'reason')); // Attributes to be displayed for the complete details
|
||||||
@@ -299,6 +306,11 @@ class URP_UserProfile extends UserRightsBaseClass
|
|||||||
MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('userid', 'profileid')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', array('userid', 'profileid')); // Criteria of the advanced search form
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetName()
|
||||||
|
{
|
||||||
|
return Dict::Format('UI:UserManagement:LinkBetween_User_And_Profile', $this->Get('userlogin'), $this->Get('profile'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -316,6 +328,7 @@ class URP_ProfileProjection extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_profileprojection",
|
"db_table" => "priv_urp_profileprojection",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -396,6 +409,7 @@ class URP_ClassProjection extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_classprojection",
|
"db_table" => "priv_urp_classprojection",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -467,6 +481,7 @@ class URP_ActionGrant extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_grant_actions",
|
"db_table" => "priv_urp_grant_actions",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -503,6 +518,7 @@ class URP_StimulusGrant extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_grant_stimulus",
|
"db_table" => "priv_urp_grant_stimulus",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -539,6 +555,7 @@ class URP_AttributeGrant extends UserRightsBaseClass
|
|||||||
"db_table" => "priv_urp_grant_attributes",
|
"db_table" => "priv_urp_grant_attributes",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
//MetaModel::Init_InheritAttributes();
|
//MetaModel::Init_InheritAttributes();
|
||||||
@@ -573,12 +590,28 @@ class UserRightsProjection extends UserRightsAddOnAPI
|
|||||||
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
||||||
{
|
{
|
||||||
// Create a change to record the history of the User object
|
// Create a change to record the history of the User object
|
||||||
CMDBObject::SetCurrentChangeFromParams('Initialization : create first user admin');
|
$oChange = MetaModel::NewObject("CMDBChange");
|
||||||
|
$oChange->Set("date", time());
|
||||||
|
$oChange->Set("userinfo", "Initialization");
|
||||||
|
$iChangeId = $oChange->DBInsert();
|
||||||
|
|
||||||
$oOrg = new Organization();
|
$oOrg = new Organization();
|
||||||
$oOrg->Set('name', 'My Company/Department');
|
$oOrg->Set('name', 'My Company/Department');
|
||||||
$oOrg->Set('code', 'SOMECODE');
|
$oOrg->Set('code', 'SOMECODE');
|
||||||
$iOrgId = $oOrg->DBInsertNoReload();
|
// $oOrg->Set('status', 'implementation');
|
||||||
|
//$oOrg->Set('parent_id', xxx);
|
||||||
|
$iOrgId = $oOrg->DBInsertTrackedNoReload($oChange, true /* skip strong security */);
|
||||||
|
|
||||||
|
// Location : optional
|
||||||
|
//$oLocation = new bizLocation();
|
||||||
|
//$oLocation->Set('name', 'MyOffice');
|
||||||
|
//$oLocation->Set('status', 'implementation');
|
||||||
|
//$oLocation->Set('org_id', $iOrgId);
|
||||||
|
//$oLocation->Set('severity', 'high');
|
||||||
|
//$oLocation->Set('address', 'my building in my city');
|
||||||
|
//$oLocation->Set('country', 'my country');
|
||||||
|
//$oLocation->Set('parent_location_id', xxx);
|
||||||
|
//$iLocationId = $oLocation->DBInsertNoReload();
|
||||||
|
|
||||||
$oContact = new Person();
|
$oContact = new Person();
|
||||||
$oContact->Set('name', 'My last name');
|
$oContact->Set('name', 'My last name');
|
||||||
@@ -586,21 +619,24 @@ class UserRightsProjection extends UserRightsAddOnAPI
|
|||||||
//$oContact->Set('status', 'available');
|
//$oContact->Set('status', 'available');
|
||||||
$oContact->Set('org_id', $iOrgId);
|
$oContact->Set('org_id', $iOrgId);
|
||||||
$oContact->Set('email', 'my.email@foo.org');
|
$oContact->Set('email', 'my.email@foo.org');
|
||||||
$iContactId = $oContact->DBInsertNoReload();
|
//$oContact->Set('phone', '');
|
||||||
|
//$oContact->Set('location_id', $iLocationId);
|
||||||
|
//$oContact->Set('employee_number', '');
|
||||||
|
$iContactId = $oContact->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
|
|
||||||
$oUser = new UserLocal();
|
$oUser = new UserLocal();
|
||||||
$oUser->Set('login', $sAdminUser);
|
$oUser->Set('login', $sAdminUser);
|
||||||
$oUser->Set('password', $sAdminPwd);
|
$oUser->Set('password', $sAdminPwd);
|
||||||
$oUser->Set('contactid', $iContactId);
|
$oUser->Set('contactid', $iContactId);
|
||||||
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
$oUser->Set('language', $sLanguage); // Language was chosen during the installation
|
||||||
$iUserId = $oUser->DBInsertNoReload();
|
$iUserId = $oUser->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
|
|
||||||
// Add this user to the very specific 'admin' profile
|
// Add this user to the very specific 'admin' profile
|
||||||
$oUserProfile = new URP_UserProfile();
|
$oUserProfile = new URP_UserProfile();
|
||||||
$oUserProfile->Set('userid', $iUserId);
|
$oUserProfile->Set('userid', $iUserId);
|
||||||
$oUserProfile->Set('profileid', ADMIN_PROFILE_ID);
|
$oUserProfile->Set('profileid', ADMIN_PROFILE_ID);
|
||||||
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
|
$oUserProfile->Set('reason', 'By definition, the administrator must have the administrator profile');
|
||||||
$oUserProfile->DBInsertNoReload();
|
$oUserProfile->DBInsertTrackedNoReload($oChange, true /* skip security */);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
29
app.php
29
app.php
@@ -1,29 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2013-2024 Combodo SAS
|
|
||||||
*
|
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
*/
|
|
||||||
|
|
||||||
use Combodo\iTop\Kernel;
|
|
||||||
|
|
||||||
require_once __DIR__.'/lib/autoload_runtime.php';
|
|
||||||
|
|
||||||
require_once('approot.inc.php');
|
|
||||||
require_once('application/startup.inc.php');
|
|
||||||
|
|
||||||
return function (array $context) {
|
|
||||||
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
|
|
||||||
};
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DBSearchHelper
|
|
||||||
*
|
|
||||||
* @since 3.0.0
|
|
||||||
*/
|
|
||||||
class DBSearchHelper
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Add context filter to DBUnionSearch
|
|
||||||
*
|
|
||||||
* @param \DBSearch|null $oSearch
|
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
* @since 3.0.0
|
|
||||||
*/
|
|
||||||
public static function AddContextFilter(?DBSearch $oSearch): void
|
|
||||||
{
|
|
||||||
$oAppContext = new ApplicationContext();
|
|
||||||
$sClass = $oSearch->GetClass();
|
|
||||||
foreach ($oAppContext->GetNames() as $key) {
|
|
||||||
// Find the value of the object corresponding to each 'context' parameter
|
|
||||||
$aCallSpec = [$sClass, 'MapContextParam'];
|
|
||||||
$sAttCode = '';
|
|
||||||
if (is_callable($aCallSpec)) {
|
|
||||||
$sAttCode = call_user_func($aCallSpec, $key); // Returns null when there is no mapping for this parameter
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MetaModel::IsValidAttCode($sClass, $sAttCode)) {
|
|
||||||
// Add Hierarchical condition if hierarchical key
|
|
||||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
|
||||||
if (isset($oAttDef) && ($oAttDef->IsExternalKey())) {
|
|
||||||
$iDefaultValue = intval($oAppContext->GetCurrentValue($key));
|
|
||||||
if ($iDefaultValue != 0) {
|
|
||||||
try {
|
|
||||||
/** @var AttributeExternalKey $oAttDef */
|
|
||||||
$sTargetClass = $oAttDef->GetTargetClass();
|
|
||||||
$sHierarchicalKeyCode = MetaModel::IsHierarchicalClass($sTargetClass);
|
|
||||||
if ($sHierarchicalKeyCode !== false) {
|
|
||||||
$oFilter = new DBObjectSearch($sTargetClass);
|
|
||||||
$oFilter->AddCondition('id', $iDefaultValue);
|
|
||||||
$oHKFilter = new DBObjectSearch($sTargetClass);
|
|
||||||
$oHKFilter->AddCondition_PointingTo($oFilter, $sHierarchicalKeyCode, TREE_OPERATOR_BELOW);
|
|
||||||
$oSearch->AddCondition_PointingTo($oHKFilter, $sAttCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception $e) {
|
|
||||||
// If filtering fails just ignore it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +1,394 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
// Copyright (C) 2010-2014 Combodo SARL
|
||||||
* @deprecated 3.0.0 will be removed in 3.1.0 - moved to sources/Application/WebPage/AjaxPage.php, now loadable using autoloader
|
//
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
// This file is part of iTop.
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
//
|
||||||
*/
|
// iTop is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
// cannot notify depreciation for now as this is still load in autoloader
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
//DeprecatedCallsLog::NotifyDeprecatedFile('moved to sources/Application/WebPage/AjaxPage.php, now loadable using autoloader');
|
// (at your option) any later version.
|
||||||
use Combodo\iTop\Application\WebPage\AjaxPage;
|
//
|
||||||
|
// iTop is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ajax_page
|
* Simple web page with no includes, header or fancy formatting, useful to
|
||||||
|
* generate HTML fragments when called by an AJAX method
|
||||||
*
|
*
|
||||||
* @deprecated 3.0.0 will be removed in 3.1.0 - moved to AjaxPage
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
class ajax_page extends AjaxPage
|
|
||||||
|
require_once(APPROOT."/application/webpage.class.inc.php");
|
||||||
|
|
||||||
|
class ajax_page extends WebPage implements iTabbedPage
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Jquery style ready script
|
||||||
|
* @var Hash
|
||||||
|
*/
|
||||||
|
protected $m_sReadyScript;
|
||||||
|
protected $m_oTabs;
|
||||||
|
private $m_sMenu; // If set, then the menu will be updated
|
||||||
|
|
||||||
|
/**
|
||||||
|
* constructor for the web page
|
||||||
|
* @param string $s_title Not used
|
||||||
|
*/
|
||||||
function __construct($s_title)
|
function __construct($s_title)
|
||||||
|
{
|
||||||
|
parent::__construct($s_title);
|
||||||
|
$this->m_sReadyScript = "";
|
||||||
|
//$this->add_header("Content-type: text/html; charset=utf-8");
|
||||||
|
$this->add_header("Cache-control: no-cache");
|
||||||
|
$this->m_oTabs = new TabManager();
|
||||||
|
$this->sContentType = 'text/html';
|
||||||
|
$this->sContentDisposition = 'inline';
|
||||||
|
$this->m_sMenu = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function AddTabContainer($sTabContainer, $sPrefix = '')
|
||||||
{
|
{
|
||||||
DeprecatedCallsLog::NotifyDeprecatedPhpMethod('ajax_page is deprecated. Please use AjaxPage instead');
|
$this->add($this->m_oTabs->AddTabContainer($sTabContainer, $sPrefix));
|
||||||
parent::__construct($s_title);
|
}
|
||||||
|
|
||||||
|
public function AddToTab($sTabContainer, $sTabLabel, $sHtml)
|
||||||
|
{
|
||||||
|
$this->add($this->m_oTabs->AddToTab($sTabContainer, $sTabLabel, $sHtml));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SetCurrentTabContainer($sTabContainer = '')
|
||||||
|
{
|
||||||
|
return $this->m_oTabs->SetCurrentTabContainer($sTabContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SetCurrentTab($sTabLabel = '')
|
||||||
|
{
|
||||||
|
return $this->m_oTabs->SetCurrentTab($sTabLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a tab which content will be loaded asynchronously via the supplied URL
|
||||||
|
*
|
||||||
|
* Limitations:
|
||||||
|
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to pull content from another server.
|
||||||
|
* Static content cannot be added inside such tabs.
|
||||||
|
*
|
||||||
|
* @param string $sTabLabel The (localised) label of the tab
|
||||||
|
* @param string $sUrl The URL to load (on the same server)
|
||||||
|
* @param boolean $bCache Whether or not to cache the content of the tab once it has been loaded. flase will cause the tab to be reloaded upon each activation.
|
||||||
|
* @since 2.0.3
|
||||||
|
*/
|
||||||
|
public function AddAjaxTab($sTabLabel, $sUrl, $bCache = true)
|
||||||
|
{
|
||||||
|
$this->add($this->m_oTabs->AddAjaxTab($sTabLabel, $sUrl, $bCache));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function GetCurrentTab()
|
||||||
|
{
|
||||||
|
return $this->m_oTabs->GetCurrentTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function RemoveTab($sTabLabel, $sTabContainer = null)
|
||||||
|
{
|
||||||
|
$this->m_oTabs->RemoveTab($sTabLabel, $sTabContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the tab whose title matches a given pattern
|
||||||
|
* @return mixed The name of the tab as a string or false if not found
|
||||||
|
*/
|
||||||
|
public function FindTab($sPattern, $sTabContainer = null)
|
||||||
|
{
|
||||||
|
return $this->m_oTabs->FindTab($sPattern, $sTabContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make the given tab the active one, as if it were clicked
|
||||||
|
* DOES NOT WORK: apparently in the *old* version of jquery
|
||||||
|
* that we are using this is not supported... TO DO upgrade
|
||||||
|
* the whole jquery bundle...
|
||||||
|
*/
|
||||||
|
public function SelectTab($sTabContainer, $sTabLabel)
|
||||||
|
{
|
||||||
|
$this->add_ready_script($this->m_oTabs->SelectTab($sTabContainer, $sTabLabel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function AddToMenu($sHtml)
|
||||||
|
{
|
||||||
|
$this->m_sMenu .= $sHtml;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Echoes the content of the whole page
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function output()
|
||||||
|
{
|
||||||
|
if (!empty($this->sContentType))
|
||||||
|
{
|
||||||
|
$this->add_header('Content-type: '.$this->sContentType);
|
||||||
|
}
|
||||||
|
if (!empty($this->sContentDisposition))
|
||||||
|
{
|
||||||
|
$this->add_header('Content-Disposition: '.$this->sContentDisposition.'; filename="'.$this->sContentFileName.'"');
|
||||||
|
}
|
||||||
|
foreach($this->a_headers as $s_header)
|
||||||
|
{
|
||||||
|
header($s_header);
|
||||||
|
}
|
||||||
|
if ($this->m_oTabs->TabsContainerCount() > 0)
|
||||||
|
{
|
||||||
|
$this->add_ready_script(
|
||||||
|
<<<EOF
|
||||||
|
// The "tab widgets" to handle.
|
||||||
|
var tabs = $('div[id^=tabbedContent]');
|
||||||
|
|
||||||
|
// Ugly patch for a change in the behavior of jQuery UI:
|
||||||
|
// Before jQuery UI 1.9, tabs were always considered as "local" (opposed to Ajax)
|
||||||
|
// when their href was beginning by #. Starting with 1.9, a <base> tag in the page
|
||||||
|
// is taken into account and causes "local" tabs to be considered as Ajax
|
||||||
|
// unless their URL is equal to the URL of the page...
|
||||||
|
if ($('base').length > 0)
|
||||||
|
{
|
||||||
|
$('div[id^=tabbedContent] > ul > li > a').each(function() {
|
||||||
|
var sHash = location.hash;
|
||||||
|
var sCleanLocation = location.href.toString().replace(sHash, '').replace(/#$/, '');
|
||||||
|
$(this).attr("href", sCleanLocation+$(this).attr("href"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ($.bbq)
|
||||||
|
{
|
||||||
|
// This selector will be reused when selecting actual tab widget A elements.
|
||||||
|
var tab_a_selector = 'ul.ui-tabs-nav a';
|
||||||
|
|
||||||
|
// Enable tabs on all tab widgets. The `event` property must be overridden so
|
||||||
|
// that the tabs aren't changed on click, and any custom event name can be
|
||||||
|
// specified. Note that if you define a callback for the 'select' event, it
|
||||||
|
// will be executed for the selected tab whenever the hash changes.
|
||||||
|
tabs.tabs({ event: 'change' });
|
||||||
|
|
||||||
|
// Define our own click handler for the tabs, overriding the default.
|
||||||
|
tabs.find( tab_a_selector ).click(function()
|
||||||
|
{
|
||||||
|
var state = {};
|
||||||
|
|
||||||
|
// Get the id of this tab widget.
|
||||||
|
var id = $(this).closest( 'div[id^=tabbedContent]' ).attr( 'id' );
|
||||||
|
|
||||||
|
// Get the index of this tab.
|
||||||
|
var idx = $(this).parent().prevAll().length;
|
||||||
|
|
||||||
|
// Set the state!
|
||||||
|
state[ id ] = idx;
|
||||||
|
$.bbq.pushState( state );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tabs.tabs();
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Render the tabs in the page (if any)
|
||||||
|
$this->s_content = $this->m_oTabs->RenderIntoContent($this->s_content);
|
||||||
|
|
||||||
|
// Additional UI widgets to be activated inside the ajax fragment ??
|
||||||
|
if (($this->sContentType == 'text/html') && (preg_match('/class="date-pick"/', $this->s_content) || preg_match('/class="datetime-pick"/', $this->s_content)) )
|
||||||
|
{
|
||||||
|
$this->add_ready_script(
|
||||||
|
<<<EOF
|
||||||
|
$(".date-pick").datepicker({
|
||||||
|
showOn: 'button',
|
||||||
|
buttonImage: '../images/calendar.png',
|
||||||
|
buttonImageOnly: true,
|
||||||
|
dateFormat: 'yy-mm-dd',
|
||||||
|
constrainInput: false,
|
||||||
|
changeMonth: true,
|
||||||
|
changeYear: true
|
||||||
|
});
|
||||||
|
$(".datetime-pick").datepicker({
|
||||||
|
showOn: 'button',
|
||||||
|
buttonImage: '../images/calendar.png',
|
||||||
|
buttonImageOnly: true,
|
||||||
|
dateFormat: 'yy-mm-dd 00:00:00',
|
||||||
|
constrainInput: false,
|
||||||
|
changeMonth: true,
|
||||||
|
changeYear: true
|
||||||
|
});
|
||||||
|
EOF
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$s_captured_output = $this->ob_get_clean_safe();
|
||||||
|
if (($this->sContentType == 'text/html') && ($this->sContentDisposition == 'inline'))
|
||||||
|
{
|
||||||
|
// inline content != attachment && html => filter all scripts for malicious XSS scripts
|
||||||
|
echo self::FilterXSS($this->s_content);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo $this->s_content;
|
||||||
|
}
|
||||||
|
if (!empty($this->m_sMenu))
|
||||||
|
{
|
||||||
|
$uid = time();
|
||||||
|
echo "<div id=\"accordion_temp_$uid\">\n";
|
||||||
|
echo "<div id=\"accordion\">\n";
|
||||||
|
echo "<!-- Beginning of the accordion menu -->\n";
|
||||||
|
echo self::FilterXSS($this->m_sMenu);
|
||||||
|
echo "<!-- End of the accordion menu-->\n";
|
||||||
|
echo "</div>\n";
|
||||||
|
echo "</div>\n";
|
||||||
|
|
||||||
|
echo "<script type=\"text/javascript\">\n";
|
||||||
|
echo "$('#inner_menu').html($('#accordion_temp_$uid').html());\n";
|
||||||
|
echo "$('#accordion_temp_$uid').remove();\n";
|
||||||
|
echo "$('#accordion').accordion({ header: 'h3', navigation: true, autoHeight: false, collapsible: false, icons: false });\n";
|
||||||
|
echo "\n</script>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
//echo $this->s_deferred_content;
|
||||||
|
if (count($this->a_scripts) > 0)
|
||||||
|
{
|
||||||
|
echo "<script type=\"text/javascript\">\n";
|
||||||
|
echo implode("\n", $this->a_scripts);
|
||||||
|
echo "\n</script>\n";
|
||||||
|
}
|
||||||
|
if (!empty($this->s_deferred_content))
|
||||||
|
{
|
||||||
|
echo "<script type=\"text/javascript\">\n";
|
||||||
|
echo "\$('body').append('".addslashes(str_replace("\n", '', $this->s_deferred_content))."');\n";
|
||||||
|
echo "\n</script>\n";
|
||||||
|
}
|
||||||
|
if (!empty($this->m_sReadyScript))
|
||||||
|
{
|
||||||
|
echo "<script type=\"text/javascript\">\n";
|
||||||
|
echo $this->m_sReadyScript; // Ready Scripts are output as simple scripts
|
||||||
|
echo "\n</script>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($s_captured_output) != "")
|
||||||
|
{
|
||||||
|
echo self::FilterXSS($s_captured_output);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (class_exists('MetaModel'))
|
||||||
|
{
|
||||||
|
MetaModel::RecordQueryTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a paragraph with a smaller font into the page
|
||||||
|
* NOT implemented (i.e does nothing)
|
||||||
|
* @param string $sText Content of the (small) paragraph
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function small_p($sText)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add($sHtml)
|
||||||
|
{
|
||||||
|
if (($this->m_oTabs->GetCurrentTabContainer() != '') && ($this->m_oTabs->GetCurrentTab() != ''))
|
||||||
|
{
|
||||||
|
$this->m_oTabs->AddToTab($this->m_oTabs->GetCurrentTabContainer(), $this->m_oTabs->GetCurrentTab(), $sHtml);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
parent::add($sHtml);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Records the current state of the 'html' part of the page output
|
||||||
|
* @return mixed The current state of the 'html' output
|
||||||
|
*/
|
||||||
|
public function start_capture()
|
||||||
|
{
|
||||||
|
$sCurrentTabContainer = $this->m_oTabs->GetCurrentTabContainer();
|
||||||
|
$sCurrentTab = $this->m_oTabs->GetCurrentTab();
|
||||||
|
|
||||||
|
if (!empty($sCurrentTabContainer) && !empty($sCurrentTab))
|
||||||
|
{
|
||||||
|
$iOffset = $this->m_oTabs->GetCurrentTabLength();
|
||||||
|
return array('tc' => $sCurrentTabContainer, 'tab' => $sCurrentTab, 'offset' => $iOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return parent::start_capture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the part of the html output that occurred since the call to start_capture
|
||||||
|
* and removes this part from the current html output
|
||||||
|
* @param $offset mixed The value returned by start_capture
|
||||||
|
* @return string The part of the html output that was added since the call to start_capture
|
||||||
|
*/
|
||||||
|
public function end_capture($offset)
|
||||||
|
{
|
||||||
|
if (is_array($offset))
|
||||||
|
{
|
||||||
|
if ($this->m_oTabs->TabExists($offset['tc'], $offset['tab']))
|
||||||
|
{
|
||||||
|
$sCaptured = $this->m_oTabs->TruncateTab($offset['tc'], $offset['tab'], $offset['offset']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sCaptured = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sCaptured = parent::end_capture($offset);
|
||||||
|
}
|
||||||
|
return $sCaptured;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add any text or HTML fragment (identified by an ID) at the end of the body of the page
|
||||||
|
* This is useful to add hidden content, DIVs or FORMs that should not
|
||||||
|
* be embedded into each other.
|
||||||
|
*/
|
||||||
|
public function add_at_the_end($s_html, $sId = '')
|
||||||
|
{
|
||||||
|
if ($sId != '')
|
||||||
|
{
|
||||||
|
$this->add_script("$('#{$sId}').remove();"); // Remove any previous instance of the same Id
|
||||||
|
}
|
||||||
|
$this->s_deferred_content .= $s_html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a script to be executed when the DOM is ready (typical JQuery use)
|
||||||
|
* NOT implemented in this version of the class.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add_ready_script($sScript)
|
||||||
|
{
|
||||||
|
$this->m_sReadyScript .= $sScript."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cannot be called in this context, since Ajax pages do not share
|
||||||
|
* any context with the calling page !!
|
||||||
|
*/
|
||||||
|
public function GetUniqueId()
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function FilterXSS($sHTML)
|
||||||
|
{
|
||||||
|
return str_ireplace(array('<script', '</script>'), array('<!-- <removed-script', '</removed-script> -->'), $sHTML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
//
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
// This file is part of iTop.
|
||||||
*/
|
//
|
||||||
|
// iTop is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// iTop is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Includes all the classes to have the application up and running
|
* Includes all the classes to have the application up and running
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(APPROOT.'/application/applicationcontext.class.inc.php');
|
require_once(APPROOT.'/application/applicationcontext.class.inc.php');
|
||||||
require_once(APPROOT.'/application/cmdbabstract.class.inc.php');
|
require_once(APPROOT.'/application/cmdbabstract.class.inc.php');
|
||||||
require_once(APPROOT.'/application/displayblock.class.inc.php');
|
require_once(APPROOT.'/application/displayblock.class.inc.php');
|
||||||
|
require_once(APPROOT.'/application/sqlblock.class.inc.php');
|
||||||
require_once(APPROOT.'/application/audit.category.class.inc.php');
|
require_once(APPROOT.'/application/audit.category.class.inc.php');
|
||||||
require_once(APPROOT.'/application/audit.domain.class.inc.php');
|
|
||||||
require_once(APPROOT.'/application/audit.rule.class.inc.php');
|
require_once(APPROOT.'/application/audit.rule.class.inc.php');
|
||||||
require_once(APPROOT.'/application/query.class.inc.php');
|
require_once(APPROOT.'/application/query.class.inc.php');
|
||||||
require_once(APPROOT.'/setup/moduleinstallation.class.inc.php');
|
require_once(APPROOT.'/setup/moduleinstallation.class.inc.php');
|
||||||
|
//require_once(APPROOT.'/application/menunode.class.inc.php');
|
||||||
require_once(APPROOT.'/application/utils.inc.php');
|
require_once(APPROOT.'/application/utils.inc.php');
|
||||||
|
|
||||||
|
class ApplicationException extends CoreException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
//
|
//
|
||||||
@@ -20,15 +20,10 @@
|
|||||||
/**
|
/**
|
||||||
* Class ApplicationContext
|
* Class ApplicationContext
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Combodo\iTop\Application\Helper\Session;
|
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
|
|
||||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
|
||||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
|
||||||
|
|
||||||
require_once(APPROOT."/application/utils.inc.php");
|
require_once(APPROOT."/application/utils.inc.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,12 +31,6 @@ require_once(APPROOT."/application/utils.inc.php");
|
|||||||
*/
|
*/
|
||||||
interface iDBObjectURLMaker
|
interface iDBObjectURLMaker
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param string $sClass
|
|
||||||
* @param string $iId
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function MakeObjectURL($sClass, $iId);
|
public static function MakeObjectURL($sClass, $iId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,13 +39,6 @@ interface iDBObjectURLMaker
|
|||||||
*/
|
*/
|
||||||
class iTopStandardURLMaker implements iDBObjectURLMaker
|
class iTopStandardURLMaker implements iDBObjectURLMaker
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param string $sClass
|
|
||||||
* @param string $iId
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public static function MakeObjectURL($sClass, $iId)
|
public static function MakeObjectURL($sClass, $iId)
|
||||||
{
|
{
|
||||||
$sPage = DBObject::ComputeStandardUIPage($sClass);
|
$sPage = DBObject::ComputeStandardUIPage($sClass);
|
||||||
@@ -71,13 +53,6 @@ class iTopStandardURLMaker implements iDBObjectURLMaker
|
|||||||
*/
|
*/
|
||||||
class PortalURLMaker implements iDBObjectURLMaker
|
class PortalURLMaker implements iDBObjectURLMaker
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param string $sClass
|
|
||||||
* @param string $iId
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public static function MakeObjectURL($sClass, $iId)
|
public static function MakeObjectURL($sClass, $iId)
|
||||||
{
|
{
|
||||||
$sAbsoluteUrl = utils::GetAbsoluteUrlAppRoot();
|
$sAbsoluteUrl = utils::GetAbsoluteUrlAppRoot();
|
||||||
@@ -99,20 +74,10 @@ class PortalURLMaker implements iDBObjectURLMaker
|
|||||||
*/
|
*/
|
||||||
class ApplicationContext
|
class ApplicationContext
|
||||||
{
|
{
|
||||||
public static $m_sUrlMakerClass = null;
|
|
||||||
protected static $m_aPluginProperties = null;
|
|
||||||
protected static $aDefaultValues; // Cache shared among all instances
|
|
||||||
|
|
||||||
protected $aNames;
|
protected $aNames;
|
||||||
protected $aValues;
|
protected $aValues;
|
||||||
|
protected static $aDefaultValues; // Cache shared among all instances
|
||||||
|
|
||||||
/**
|
|
||||||
* ApplicationContext constructor.
|
|
||||||
*
|
|
||||||
* @param bool $bReadContext
|
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public function __construct($bReadContext = true)
|
public function __construct($bReadContext = true)
|
||||||
{
|
{
|
||||||
$this->aNames = array(
|
$this->aNames = array(
|
||||||
@@ -125,12 +90,10 @@ class ApplicationContext
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read the context directly in the PHP parameters (either POST or GET)
|
* Read the context directly in the PHP parameters (either POST or GET)
|
||||||
* return nothing
|
* return nothing
|
||||||
*
|
*/
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
protected function ReadContext()
|
protected function ReadContext()
|
||||||
{
|
{
|
||||||
if (!isset(self::$aDefaultValues))
|
if (!isset(self::$aDefaultValues))
|
||||||
@@ -147,26 +110,20 @@ class ApplicationContext
|
|||||||
}
|
}
|
||||||
// Hmm, there must be a better (more generic) way to handle the case below:
|
// Hmm, there must be a better (more generic) way to handle the case below:
|
||||||
// When there is only one possible (allowed) organization, the context must be
|
// When there is only one possible (allowed) organization, the context must be
|
||||||
// fixed to this org unless there is only one organization in the system then
|
// fixed to this org
|
||||||
// no filter is applied
|
|
||||||
if ($sName == 'org_id')
|
if ($sName == 'org_id')
|
||||||
{
|
{
|
||||||
if (MetaModel::IsValidClass('Organization'))
|
if (MetaModel::IsValidClass('Organization'))
|
||||||
{
|
{
|
||||||
$oSearchFilter = new DBObjectSearch('Organization');
|
$oSearchFilter = new DBObjectSearch('Organization');
|
||||||
|
$oSearchFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
|
||||||
$oSet = new CMDBObjectSet($oSearchFilter);
|
$oSet = new CMDBObjectSet($oSearchFilter);
|
||||||
$iCount = $oSet->CountWithLimit(2);
|
$iCount = $oSet->Count();
|
||||||
if ($iCount > 1)
|
if ($iCount == 1)
|
||||||
{
|
{
|
||||||
$oSearchFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', true);
|
// Only one possible value for org_id, set it in the context
|
||||||
$oSet = new CMDBObjectSet($oSearchFilter);
|
$oOrg = $oSet->Fetch();
|
||||||
$iCount = $oSet->CountWithLimit(2);
|
self::$aDefaultValues[$sName] = $oOrg->GetKey();
|
||||||
if ($iCount == 1)
|
|
||||||
{
|
|
||||||
// Only one possible value for org_id, set it in the context
|
|
||||||
$oOrg = $oSet->Fetch();
|
|
||||||
self::$aDefaultValues[$sName] = $oOrg->GetKey();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,14 +132,11 @@ class ApplicationContext
|
|||||||
$this->aValues = self::$aDefaultValues;
|
$this->aValues = self::$aDefaultValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current value for the given parameter
|
* Returns the current value for the given parameter
|
||||||
*
|
* @param string $sParamName Name of the parameter to read
|
||||||
* @param string $sParamName Name of the parameter to read
|
* @return mixed The value for this parameter
|
||||||
* @param string $defaultValue
|
*/
|
||||||
*
|
|
||||||
* @return mixed The value for this parameter
|
|
||||||
*/
|
|
||||||
public function GetCurrentValue($sParamName, $defaultValue = '')
|
public function GetCurrentValue($sParamName, $defaultValue = '')
|
||||||
{
|
{
|
||||||
if (isset($this->aValues[$sParamName]))
|
if (isset($this->aValues[$sParamName]))
|
||||||
@@ -194,7 +148,7 @@ class ApplicationContext
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the context as string with the format name1=value1&name2=value2....
|
* Returns the context as string with the format name1=value1&name2=value2....
|
||||||
* @return string The context as a string to be appended to an href property
|
* return string The context as a string to be appended to an href property
|
||||||
*/
|
*/
|
||||||
public function GetForLink()
|
public function GetForLink()
|
||||||
{
|
{
|
||||||
@@ -205,61 +159,24 @@ class ApplicationContext
|
|||||||
}
|
}
|
||||||
return implode("&", $aParams);
|
return implode("&", $aParams);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @since 3.0.0 N°2534 - dashboard: bug with autorefresh that deactivates filtering on organisation
|
|
||||||
* Returns the params as c[menu]:..., c[org_id]:....
|
|
||||||
* @return string The params
|
|
||||||
*/
|
|
||||||
public function GetForPostParams()
|
|
||||||
{
|
|
||||||
return json_encode($this->aValues);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the context as sequence of input tags to be inserted inside a <form> tag
|
* Returns the context as sequence of input tags to be inserted inside a <form> tag
|
||||||
*
|
* return string The context as a sequence of <input type="hidden" /> tags
|
||||||
* @return string The context as a sequence of <input type="hidden" /> tags
|
|
||||||
*/
|
*/
|
||||||
public function GetForForm()
|
public function GetForForm()
|
||||||
{
|
{
|
||||||
$sContext = "";
|
$sContext = "";
|
||||||
foreach ($this->aValues as $sName => $sValue) {
|
foreach($this->aValues as $sName => $sValue)
|
||||||
$sContext .= "<input type=\"hidden\" name=\"c[$sName]\" value=\"".utils::EscapeHtml($sValue)."\" />\n";
|
{
|
||||||
|
$sContext .= "<input type=\"hidden\" name=\"c[$sName]\" value=\"".htmlentities($sValue, ENT_QUOTES, 'UTF-8')."\" />\n";
|
||||||
}
|
}
|
||||||
return $sContext;
|
return $sContext;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Returns the context an array of input blocks
|
|
||||||
*
|
|
||||||
* @return array The context as a sequence of <input type="hidden" /> tags
|
|
||||||
* @since 3.0.0
|
|
||||||
*/
|
|
||||||
public function GetForUIForm()
|
|
||||||
{
|
|
||||||
$aContextInputBlocks = [];
|
|
||||||
foreach ($this->aValues as $sName => $sValue) {
|
|
||||||
$aContextInputBlocks[] = InputUIBlockFactory::MakeForHidden("c[$sName]", $sValue);
|
|
||||||
}
|
|
||||||
return $aContextInputBlocks;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the context as sequence of input tags to be inserted inside a <form> tag
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function GetForFormBlock(): UIBlock
|
|
||||||
{
|
|
||||||
$oContext = new UIContentBlock();
|
|
||||||
foreach ($this->aValues as $sName => $sValue) {
|
|
||||||
$oContext->AddSubBlock(InputUIBlockFactory::MakeForHidden('c[$sName]', utils::HtmlEntities($sValue)));
|
|
||||||
}
|
|
||||||
return $oContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the context as a hash array 'parameter_name' => value
|
* Returns the context as a hash array 'parameter_name' => value
|
||||||
*
|
* return array The context information
|
||||||
* @return array The context information
|
|
||||||
*/
|
*/
|
||||||
public function GetAsHash()
|
public function GetAsHash()
|
||||||
{
|
{
|
||||||
@@ -283,6 +200,7 @@ class ApplicationContext
|
|||||||
* Removes the specified parameter from the context, for example when the same parameter
|
* Removes the specified parameter from the context, for example when the same parameter
|
||||||
* is already a search parameter
|
* is already a search parameter
|
||||||
* @param string $sParamName Name of the parameter to remove
|
* @param string $sParamName Name of the parameter to remove
|
||||||
|
* @return none
|
||||||
*/
|
*/
|
||||||
public function Reset($sParamName)
|
public function Reset($sParamName)
|
||||||
{
|
{
|
||||||
@@ -294,11 +212,6 @@ class ApplicationContext
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the given object with the default values provided by the context
|
* Initializes the given object with the default values provided by the context
|
||||||
*
|
|
||||||
* @param \DBObject $oObj
|
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
* @throws \CoreUnexpectedValue
|
|
||||||
*/
|
*/
|
||||||
public function InitObjectFromContext(DBObject &$oObj)
|
public function InitObjectFromContext(DBObject &$oObj)
|
||||||
{
|
{
|
||||||
@@ -326,17 +239,19 @@ class ApplicationContext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static $m_sUrlMakerClass = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current application url provider
|
* Set the current application url provider
|
||||||
* @param string $sClass Class implementing iDBObjectURLMaker
|
* @param sClass string Class implementing iDBObjectURLMaker
|
||||||
* @return string
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function SetUrlMakerClass($sClass = 'iTopStandardURLMaker')
|
public static function SetUrlMakerClass($sClass = 'iTopStandardURLMaker')
|
||||||
{
|
{
|
||||||
$sPrevious = self::GetUrlMakerClass();
|
$sPrevious = self::GetUrlMakerClass();
|
||||||
|
|
||||||
self::$m_sUrlMakerClass = $sClass;
|
self::$m_sUrlMakerClass = $sClass;
|
||||||
Session::Set('UrlMakerClass', $sClass);
|
$_SESSION['UrlMakerClass'] = $sClass;
|
||||||
|
|
||||||
return $sPrevious;
|
return $sPrevious;
|
||||||
}
|
}
|
||||||
@@ -349,9 +264,9 @@ class ApplicationContext
|
|||||||
{
|
{
|
||||||
if (is_null(self::$m_sUrlMakerClass))
|
if (is_null(self::$m_sUrlMakerClass))
|
||||||
{
|
{
|
||||||
if (Session::IsSet('UrlMakerClass'))
|
if (isset($_SESSION['UrlMakerClass']))
|
||||||
{
|
{
|
||||||
self::$m_sUrlMakerClass = Session::Get('UrlMakerClass');
|
self::$m_sUrlMakerClass = $_SESSION['UrlMakerClass'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -363,43 +278,45 @@ class ApplicationContext
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current application url provider
|
* Get the current application url provider
|
||||||
*
|
|
||||||
* @param string $sObjClass
|
|
||||||
* @param string $sObjKey
|
|
||||||
* @param null $sUrlMakerClass
|
|
||||||
* @param bool $bWithNavigationContext
|
|
||||||
*
|
|
||||||
* @return string the name of the class
|
* @return string the name of the class
|
||||||
* @throws \Exception
|
|
||||||
*/
|
*/
|
||||||
public static function MakeObjectUrl($sObjClass, $sObjKey, $sUrlMakerClass = null, $bWithNavigationContext = true)
|
public static function MakeObjectUrl($sObjClass, $sObjKey, $sUrlMakerClass = null, $bWithNavigationContext = true)
|
||||||
{
|
{
|
||||||
$oAppContext = new ApplicationContext();
|
$oAppContext = new ApplicationContext();
|
||||||
|
|
||||||
if (is_null($sUrlMakerClass)) {
|
if (is_null($sUrlMakerClass))
|
||||||
$sUrlMakerClass = self::GetUrlMakerClass();
|
{
|
||||||
}
|
$sUrlMakerClass = self::GetUrlMakerClass();
|
||||||
|
}
|
||||||
$sUrl = call_user_func(array($sUrlMakerClass, 'MakeObjectUrl'), $sObjClass, $sObjKey);
|
$sUrl = call_user_func(array($sUrlMakerClass, 'MakeObjectUrl'), $sObjClass, $sObjKey);
|
||||||
if (utils::StrLen($sUrl) > 0) {
|
if (strlen($sUrl) > 0)
|
||||||
if ($bWithNavigationContext) {
|
{
|
||||||
return $sUrl."&".$oAppContext->GetForLink();
|
if ($bWithNavigationContext)
|
||||||
} else {
|
{
|
||||||
return $sUrl;
|
return $sUrl."&".$oAppContext->GetForLink();
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
return '';
|
{
|
||||||
}
|
return $sUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static $m_aPluginProperties = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load plugin properties for the current session
|
* Load plugin properties for the current session
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected static function LoadPluginProperties()
|
protected static function LoadPluginProperties()
|
||||||
{
|
{
|
||||||
if (Session::IsSet('PluginProperties'))
|
if (isset($_SESSION['PluginProperties']))
|
||||||
{
|
{
|
||||||
self::$m_aPluginProperties = Session::Get('PluginProperties');
|
self::$m_aPluginProperties = $_SESSION['PluginProperties'];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -409,9 +326,9 @@ class ApplicationContext
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set plugin properties
|
* Set plugin properties
|
||||||
* @param string $sPluginClass Class implementing any plugin interface
|
* @param sPluginClass string Class implementing any plugin interface
|
||||||
* @param string $sProperty Name of the property
|
* @param sProperty string Name of the property
|
||||||
* @param mixed $value Value (numeric or string)
|
* @param value scalar Value (numeric or string)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function SetPluginProperty($sPluginClass, $sProperty, $value)
|
public static function SetPluginProperty($sPluginClass, $sProperty, $value)
|
||||||
@@ -419,12 +336,12 @@ class ApplicationContext
|
|||||||
if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties();
|
if (is_null(self::$m_aPluginProperties)) self::LoadPluginProperties();
|
||||||
|
|
||||||
self::$m_aPluginProperties[$sPluginClass][$sProperty] = $value;
|
self::$m_aPluginProperties[$sPluginClass][$sProperty] = $value;
|
||||||
Session::Set(['PluginProperties', $sPluginClass, $sProperty], $value);
|
$_SESSION['PluginProperties'][$sPluginClass][$sProperty] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get plugin properties
|
* Get plugin properties
|
||||||
* @param string $sPluginClass Class implementing any plugin interface
|
* @param sPluginClass string Class implementing any plugin interface
|
||||||
* @return array of sProperty=>value pairs
|
* @return array of sProperty=>value pairs
|
||||||
*/
|
*/
|
||||||
public static function GetPluginProperties($sPluginClass)
|
public static function GetPluginProperties($sPluginClass)
|
||||||
@@ -442,3 +359,4 @@ class ApplicationContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
//
|
//
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* to check and is linked to a set of rules that determine the valid or invalid objects
|
* to check and is linked to a set of rules that determine the valid or invalid objects
|
||||||
* inside the set
|
* inside the set
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -34,63 +34,27 @@ class AuditCategory extends cmdbAbstractObject
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "application,grant_by_profile",
|
"category" => "application",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array('name'),
|
"reconc_keys" => array('name'),
|
||||||
"db_table" => "priv_auditcategory",
|
"db_table" => "priv_auditcategory",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-folder.svg'),
|
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("description"=>"Short name for this category", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeString("name", array("description"=>"Short name for this category", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", array("allowed_values"=>null, "sql"=>"definition_set", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", array("allowed_values"=>null, "sql"=>"definition_set", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", array("linked_class"=>"AuditRule", "ext_key_to_me"=>"category_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array(), "edit_mode" => LINKSET_EDITMODE_INPLACE, "tracking_level" => LINKSET_TRACKING_ALL)));
|
MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", array("linked_class"=>"AuditRule", "ext_key_to_me"=>"category_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array(), "edit_mode" => LINKSET_EDITMODE_INPLACE)));
|
||||||
MetaModel::Init_AddAttribute(new AttributeInteger("ok_error_tolerance", array("allowed_values"=>null, "sql"=>"ok_error_tolerance", "default_value"=>5, "is_null_allowed"=>true, "depends_on"=>array())));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeInteger("warning_error_tolerance", array("allowed_values" => null, "sql" => "warning_error_tolerance", "default_value" => 25, "is_null_allowed" => true, "depends_on" => array())));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("domains_list",
|
|
||||||
array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "category_id", "ext_key_to_remote" => "domain_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array(), "display_style" => 'property')));
|
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'ok_error_tolerance', 'warning_error_tolerance', 'rules_list', 'domains_list')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'rules_list')); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('description', 'definition_set')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('name', 'description')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
|
MetaModel::Init_SetZListItems('advanced_search', array('name', 'description', 'definition_set')); // Criteria of the advanced search form
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $iTotal
|
|
||||||
* @param int $iErrors
|
|
||||||
*
|
|
||||||
* @return string A semantic color name (eg. red, green, orange, success, failure, ... {@see css/backoffice/utils/variables/colors/_semantic-palette.scss}) to use for this category depending on its error count and tolerance
|
|
||||||
* @throws \CoreException
|
|
||||||
*
|
|
||||||
* @since 3.1.0
|
|
||||||
*/
|
|
||||||
public function GetReportColor($iTotal, $iErrors)
|
|
||||||
{
|
|
||||||
$sResult = 'red';
|
|
||||||
if ( ($iTotal == 0) || ($iErrors / $iTotal) <= ($this->Get('ok_error_tolerance') / 100) ) {
|
|
||||||
$sResult = 'green';
|
|
||||||
} else if (($iErrors / $iTotal) <= ($this->Get('warning_error_tolerance') / 100)) {
|
|
||||||
$sResult = 'orange';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function GetShortcutActions($sFinalClass)
|
|
||||||
{
|
|
||||||
$aShortcutActions = parent::GetShortcutActions($sFinalClass);
|
|
||||||
if (!in_array('UI:Menu:RunAudit', $aShortcutActions)) {
|
|
||||||
$aShortcutActions[] = 'UI:Menu:RunAudit';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $aShortcutActions;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,123 +0,0 @@
|
|||||||
<?php
|
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
//
|
|
||||||
// This file is part of iTop.
|
|
||||||
//
|
|
||||||
// iTop is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU Affero General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// iTop is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU Affero General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
|
||||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class manages the audit "categories". Each category defines a set of objects
|
|
||||||
* to check and is linked to a set of rules that determine the valid or invalid objects
|
|
||||||
* inside the set
|
|
||||||
*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 3.1.0
|
|
||||||
*/
|
|
||||||
class AuditDomain extends cmdbAbstractObject
|
|
||||||
{
|
|
||||||
public static function Init()
|
|
||||||
{
|
|
||||||
$aParams = array
|
|
||||||
(
|
|
||||||
"category" => "application,grant_by_profile",
|
|
||||||
"key_type" => "autoincrement",
|
|
||||||
"name_attcode" => "name",
|
|
||||||
"complementary_name_attcode" => array('description'),
|
|
||||||
"state_attcode" => "",
|
|
||||||
"reconc_keys" => array('name'),
|
|
||||||
"db_table" => "priv_auditdomain",
|
|
||||||
"db_key_field" => "id",
|
|
||||||
"db_finalclass_field" => "",
|
|
||||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit-album.svg'),
|
|
||||||
);
|
|
||||||
MetaModel::Init_Params($aParams);
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("description" => "Short name for this category", "allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => array())));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => array())));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeImage("icon", array("is_null_allowed" => true, "depends_on" => array(), "display_max_width" => 96, "display_max_height" => 96, "storage_max_width" => 256, "storage_max_height" => 256, "default_image" => null, "always_load_in_tables" => false)));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("categories_list",
|
|
||||||
array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "domain_id", "ext_key_to_remote" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array())));
|
|
||||||
|
|
||||||
// Display lists
|
|
||||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'icon', 'categories_list')); // Attributes to be displayed for the complete details
|
|
||||||
MetaModel::Init_SetZListItems('list', array('description',)); // Attributes to be displayed for a list
|
|
||||||
// Search criteria
|
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('description')); // Criteria of the std search form
|
|
||||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function GetShortcutActions($sFinalClass)
|
|
||||||
{
|
|
||||||
$aShortcutActions = parent::GetShortcutActions($sFinalClass);
|
|
||||||
if (!in_array('UI:Menu:RunAudit', $aShortcutActions)) {
|
|
||||||
$aShortcutActions[] = 'UI:Menu:RunAudit';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $aShortcutActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @since 3.1.0
|
|
||||||
*/
|
|
||||||
class lnkAuditCategoryToAuditDomain extends cmdbAbstractObject
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @throws \CoreException
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public static function Init()
|
|
||||||
{
|
|
||||||
$aParams = array
|
|
||||||
(
|
|
||||||
"category" => "application,grant_by_profile",
|
|
||||||
"key_type" => "autoincrement",
|
|
||||||
"name_attcode" => "",
|
|
||||||
"state_attcode" => "",
|
|
||||||
"reconc_keys" => array('category_id', 'domain_id'),
|
|
||||||
"db_table" => "priv_link_audit_category_domain",
|
|
||||||
"db_key_field" => "id",
|
|
||||||
"db_finalclass_field" => "",
|
|
||||||
"is_link" => true,
|
|
||||||
'uniqueness_rules' => array(
|
|
||||||
'no_duplicate' => array(
|
|
||||||
'attributes' => array(
|
|
||||||
0 => 'category_id',
|
|
||||||
1 => 'domain_id',
|
|
||||||
),
|
|
||||||
'filter' => '',
|
|
||||||
'disabled' => false,
|
|
||||||
'is_blocking' => true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
MetaModel::Init_Params($aParams);
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("targetclass" => "AuditCategory", "jointype" => '', "allowed_values" => null, "sql" => "category_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name")));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("domain_id", array("targetclass" => "AuditDomain", "jointype" => '', "allowed_values" => null, "sql" => "domain_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("domain_name", array("allowed_values" => null, "extkey_attcode" => 'domain_id', "target_attcode" => "name")));
|
|
||||||
|
|
||||||
// Display lists
|
|
||||||
MetaModel::Init_SetZListItems('details', array('category_id', 'domain_id'));
|
|
||||||
MetaModel::Init_SetZListItems('list', array('category_id', 'domain_id'));
|
|
||||||
// Search criteria
|
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('category_id', 'domain_id'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
//
|
//
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
* or the "bad" ones. The core audit engines computes the complement to the definition
|
* or the "bad" ones. The core audit engines computes the complement to the definition
|
||||||
* set when needed to obtain either the valid objects, or the ones with an error
|
* set when needed to obtain either the valid objects, or the ones with an error
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -35,41 +35,30 @@ class AuditRule extends cmdbAbstractObject
|
|||||||
{
|
{
|
||||||
$aParams = array
|
$aParams = array
|
||||||
(
|
(
|
||||||
"category" => "application,grant_by_profile",
|
"category" => "application",
|
||||||
"key_type" => "autoincrement",
|
"key_type" => "autoincrement",
|
||||||
"name_attcode" => "name",
|
"name_attcode" => "name",
|
||||||
"state_attcode" => "",
|
"state_attcode" => "",
|
||||||
"reconc_keys" => array('name'),
|
"reconc_keys" => array('name'),
|
||||||
"db_table" => "priv_auditrule",
|
"db_table" => "priv_auditrule",
|
||||||
"db_key_field" => "id",
|
"db_key_field" => "id",
|
||||||
"db_finalclass_field" => "",
|
"db_finalclass_field" => "",
|
||||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-audit.svg'),
|
"display_template" => "",
|
||||||
);
|
);
|
||||||
MetaModel::Init_Params($aParams);
|
MetaModel::Init_Params($aParams);
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values" => null, "sql" => "name", "default_value" => "", "is_null_allowed" => false, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => "", "is_null_allowed" => true, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeOQL("query", array("allowed_values" => null, "sql" => "query", "default_value" => "", "is_null_allowed" => false, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeOQL("query", array("allowed_values"=>null, "sql"=>"query", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeEnum("valid_flag", array("allowed_values" => new ValueSetEnum('true,false'), "sql" => "valid_flag", "default_value" => "true", "is_null_allowed" => false, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeEnum("valid_flag", array("allowed_values"=>new ValueSetEnum('true,false'), "sql"=>"valid_flag", "default_value"=>"true", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("allowed_values" => null, "sql" => "category_id", "targetclass" => "AuditCategory", "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => array())));
|
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("allowed_values"=>null, "sql"=>"category_id", "targetclass"=>"AuditCategory", "is_null_allowed"=>false, "on_target_delete"=>DEL_MANUAL, "depends_on"=>array())));
|
||||||
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name")));
|
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values"=>null, "extkey_attcode"=> 'category_id', "target_attcode"=>"name")));
|
||||||
|
|
||||||
// Display lists
|
// Display lists
|
||||||
MetaModel::Init_SetZListItems('details', array('category_id', 'name', 'description', 'query', 'valid_flag')); // Attributes to be displayed for the complete details
|
MetaModel::Init_SetZListItems('details', array('category_id', 'name', 'description', 'query', 'valid_flag')); // Attributes to be displayed for the complete details
|
||||||
MetaModel::Init_SetZListItems('list', array('category_id', 'description', 'valid_flag')); // Attributes to be displayed for a list
|
MetaModel::Init_SetZListItems('list', array('category_id', 'description', 'valid_flag')); // Attributes to be displayed for a list
|
||||||
// Search criteria
|
// Search criteria
|
||||||
MetaModel::Init_SetZListItems('standard_search', array('category_id', 'name', 'description', 'valid_flag', 'query')); // Criteria of the std search form
|
MetaModel::Init_SetZListItems('standard_search', array('category_id', 'name', 'description', 'valid_flag')); // Criteria of the std search form
|
||||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description', 'category_id')); // Criteria of the advanced search form
|
MetaModel::Init_SetZListItems('advanced_search', array('category_id', 'name', 'description', 'valid_flag', 'query')); // Criteria of the advanced search form
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static function GetShortcutActions($sFinalClass)
|
|
||||||
{
|
|
||||||
$aShortcutActions = parent::GetShortcutActions($sFinalClass);
|
|
||||||
if (!in_array('UI:Menu:RunAudit', $aShortcutActions)) {
|
|
||||||
$aShortcutActions[] = 'UI:Menu:RunAudit';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $aShortcutActions;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @deprecated 3.0.0 will be removed in 3.1.0 - moved to sources/Application/WebPage/CaptureWebPage.php, now loadable using autoloader
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*/
|
|
||||||
|
|
||||||
DeprecatedCallsLog::NotifyDeprecatedFile('moved to sources/Application/WebPage/CaptureWebPage.php, now loadable using autoloader');
|
|
||||||
@@ -1,8 +1,97 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
|
//
|
||||||
|
// This file is part of iTop.
|
||||||
|
//
|
||||||
|
// iTop is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// iTop is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 3.0.0 will be removed in 3.1.0 - moved to sources/Application/WebPage/CLIPage.php, now loadable using autoloader
|
* CLI page
|
||||||
|
* The page adds the content-type text/XML and the encoding into the headers
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DeprecatedCallsLog::NotifyDeprecatedFile('moved to sources/Application/WebPage/CLIPage.php, now loadable using autoloader');
|
require_once(APPROOT."/application/webpage.class.inc.php");
|
||||||
|
|
||||||
|
class CLIPage implements Page
|
||||||
|
{
|
||||||
|
function __construct($s_title)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function output()
|
||||||
|
{
|
||||||
|
if (class_exists('MetaModel'))
|
||||||
|
{
|
||||||
|
MetaModel::RecordQueryTrace();
|
||||||
|
}
|
||||||
|
if (class_exists('ExecutionKPI'))
|
||||||
|
{
|
||||||
|
ExecutionKPI::ReportStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add($sText)
|
||||||
|
{
|
||||||
|
echo $sText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function p($sText)
|
||||||
|
{
|
||||||
|
echo $sText."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function pre($sText)
|
||||||
|
{
|
||||||
|
echo $sText."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add_comment($sText)
|
||||||
|
{
|
||||||
|
echo "#".$sText."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function table($aConfig, $aData, $aParams = array())
|
||||||
|
{
|
||||||
|
$aCells = array();
|
||||||
|
foreach($aConfig as $sName=>$aDef)
|
||||||
|
{
|
||||||
|
if (strlen($aDef['description']) > 0)
|
||||||
|
{
|
||||||
|
$aCells[] = $aDef['label'].' ('.$aDef['description'].')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$aCells[] = $aDef['label'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo implode(';', $aCells)."\n";
|
||||||
|
|
||||||
|
foreach($aData as $aRow)
|
||||||
|
{
|
||||||
|
$aCells = array();
|
||||||
|
foreach($aConfig as $sName=>$aAttribs)
|
||||||
|
{
|
||||||
|
$sValue = $aRow["$sName"];
|
||||||
|
$aCells[] = $sValue;
|
||||||
|
}
|
||||||
|
echo implode(';', $aCells)."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,38 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* Copyright (C) 2013-2024 Combodo SAS
|
|
||||||
*
|
|
||||||
* This file is part of iTop.
|
|
||||||
*
|
|
||||||
* iTop is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* iTop is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CompileCSSService : used to ease testing ThemeHander class via mocks
|
|
||||||
*
|
|
||||||
* @author Olivier DAIN <olivier.dain@combodo.com>
|
|
||||||
* @since 3.0.0 N°2982
|
|
||||||
*/
|
|
||||||
class CompileCSSService
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* CompileCSSService constructor.
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public function CompileCSSFromSASS($sSassContent, $aImportPaths = [], $aVariables = []){
|
|
||||||
return utils::CompileCSSFromSASS($sSassContent, $aImportPaths, $aVariables);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,111 @@
|
|||||||
<?php
|
<?php
|
||||||
|
// Copyright (C) 2010-2014 Combodo SARL
|
||||||
|
//
|
||||||
|
// This file is part of iTop.
|
||||||
|
//
|
||||||
|
// iTop is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Affero General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// iTop is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated 3.0.0 will be removed in 3.1.0 - moved to sources/Application/WebPage/CSVPage.php, now loadable using autoloader
|
* Simple web page with no includes or fancy formatting, useful to generateXML documents
|
||||||
|
* The page adds the content-type text/XML and the encoding into the headers
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DeprecatedCallsLog::NotifyDeprecatedFile('moved to sources/Application/WebPage/CSVPage.php, now loadable using autoloader');
|
require_once(APPROOT."/application/webpage.class.inc.php");
|
||||||
|
|
||||||
|
class CSVPage extends WebPage
|
||||||
|
{
|
||||||
|
function __construct($s_title)
|
||||||
|
{
|
||||||
|
parent::__construct($s_title);
|
||||||
|
$this->add_header("Content-type: text/plain; charset=utf-8");
|
||||||
|
$this->add_header("Cache-control: no-cache");
|
||||||
|
//$this->add_header("Content-Transfer-Encoding: binary");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function output()
|
||||||
|
{
|
||||||
|
$this->add_header("Content-Length: ".strlen(trim($this->s_content)));
|
||||||
|
|
||||||
|
// Get the unexpected output but do nothing with it
|
||||||
|
$sTrash = $this->ob_get_clean_safe();
|
||||||
|
|
||||||
|
foreach($this->a_headers as $s_header)
|
||||||
|
{
|
||||||
|
header($s_header);
|
||||||
|
}
|
||||||
|
echo trim($this->s_content);
|
||||||
|
echo "\n";
|
||||||
|
|
||||||
|
if (class_exists('MetaModel'))
|
||||||
|
{
|
||||||
|
MetaModel::RecordQueryTrace();
|
||||||
|
}
|
||||||
|
if (class_exists('ExecutionKPI'))
|
||||||
|
{
|
||||||
|
ExecutionKPI::ReportStats();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function small_p($sText)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add($sText)
|
||||||
|
{
|
||||||
|
$this->s_content .= $sText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function p($sText)
|
||||||
|
{
|
||||||
|
$this->s_content .= $sText."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function add_comment($sText)
|
||||||
|
{
|
||||||
|
$this->s_content .= "#".$sText."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function table($aConfig, $aData, $aParams = array())
|
||||||
|
{
|
||||||
|
$aCells = array();
|
||||||
|
foreach($aConfig as $sName=>$aDef)
|
||||||
|
{
|
||||||
|
if (strlen($aDef['description']) > 0)
|
||||||
|
{
|
||||||
|
$aCells[] = $aDef['label'].' ('.$aDef['description'].')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$aCells[] = $aDef['label'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->s_content .= implode(';', $aCells)."\n";
|
||||||
|
|
||||||
|
foreach($aData as $aRow)
|
||||||
|
{
|
||||||
|
$aCells = array();
|
||||||
|
foreach($aConfig as $sName=>$aAttribs)
|
||||||
|
{
|
||||||
|
$sValue = $aRow["$sName"];
|
||||||
|
$aCells[] = $sValue;
|
||||||
|
}
|
||||||
|
$this->s_content .= implode(';', $aCells)."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// Copyright (C) 2010-2024 Combodo SAS
|
// Copyright (C) 2010-2012 Combodo SARL
|
||||||
//
|
//
|
||||||
// This file is part of iTop.
|
// This file is part of iTop.
|
||||||
//
|
//
|
||||||
@@ -15,31 +15,25 @@
|
|||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
|
||||||
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardColumn;
|
|
||||||
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardLayout as DashboardLayoutUIBlock;
|
|
||||||
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardRow;
|
|
||||||
use Combodo\iTop\Application\WebPage\WebPage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dashboard presentation
|
* Dashboard presentation
|
||||||
*
|
*
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
* @copyright Copyright (C) 2010-2012 Combodo SARL
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
* @license http://opensource.org/licenses/AGPL-3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
abstract class DashboardLayout
|
abstract class DashboardLayout
|
||||||
{
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
abstract public function Render($oPage, $aDashlets, $bEditMode = false);
|
abstract public function Render($oPage, $aDashlets, $bEditMode = false);
|
||||||
|
|
||||||
/**
|
static public function GetInfo()
|
||||||
* @param int $iCellIdx
|
|
||||||
*
|
|
||||||
* @return array Containing 2 scalars: Col number and row number (starting from 0)
|
|
||||||
* @since 2.7.0
|
|
||||||
*/
|
|
||||||
abstract public function GetDashletCoordinates($iCellIdx);
|
|
||||||
|
|
||||||
public static function GetInfo()
|
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'label' => '',
|
'label' => '',
|
||||||
@@ -65,9 +59,8 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
|||||||
$bNoVisibleFound = true;
|
$bNoVisibleFound = true;
|
||||||
while($idx < count($aKeys) && $bNoVisibleFound)
|
while($idx < count($aKeys) && $bNoVisibleFound)
|
||||||
{
|
{
|
||||||
/** @var \Dashlet $oDashlet */
|
|
||||||
$oDashlet = $aDashlets[$aKeys[$idx]];
|
$oDashlet = $aDashlets[$aKeys[$idx]];
|
||||||
if ($oDashlet::IsVisible())
|
if ($oDashlet->IsVisible())
|
||||||
{
|
{
|
||||||
$bNoVisibleFound = false;
|
$bNoVisibleFound = false;
|
||||||
}
|
}
|
||||||
@@ -106,81 +99,64 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param WebPage $oPage
|
|
||||||
* @param $aCells
|
|
||||||
* @param bool $bEditMode
|
|
||||||
* @param array $aExtraParams
|
|
||||||
*/
|
|
||||||
public function Render($oPage, $aCells, $bEditMode = false, $aExtraParams = array())
|
public function Render($oPage, $aCells, $bEditMode = false, $aExtraParams = array())
|
||||||
{
|
{
|
||||||
// Trim the list of cells to remove the invisible/empty ones at the end of the array
|
// Trim the list of cells to remove the invisible/empty ones at the end of the array
|
||||||
$aCells = $this->TrimCellsArray($aCells);
|
$aCells = $this->TrimCellsArray($aCells);
|
||||||
|
|
||||||
$oDashboardLayout = new DashboardLayoutUIBlock();
|
$oPage->add('<table style="width:100%"><tbody>');
|
||||||
//$oPage->AddUiBlock($oDashboardLayout);
|
|
||||||
|
|
||||||
$iCellIdx = 0;
|
$iCellIdx = 0;
|
||||||
|
$fColSize = 100 / $this->iNbCols;
|
||||||
|
$sStyle = $bEditMode ? 'border: 1px #ccc dashed; width:'.$fColSize.'%;' : 'width: '.$fColSize.'%;';
|
||||||
|
$sClass = $bEditMode ? 'layout_cell edit_mode' : 'dashboard';
|
||||||
$iNbRows = ceil(count($aCells) / $this->iNbCols);
|
$iNbRows = ceil(count($aCells) / $this->iNbCols);
|
||||||
|
for($iRows = 0; $iRows < $iNbRows; $iRows++)
|
||||||
//Js given by each dashlet to reload
|
{
|
||||||
$sJSReload = "";
|
$oPage->add('<tr>');
|
||||||
|
for($iCols = 0; $iCols < $this->iNbCols; $iCols++)
|
||||||
for ($iRows = 0; $iRows < $iNbRows; $iRows++) {
|
{
|
||||||
$oDashboardRow = new DashboardRow();
|
$sCellClass = ($iRows == $iNbRows-1) ? $sClass.' layout_last_used_rank' : $sClass;
|
||||||
$oDashboardLayout->AddDashboardRow($oDashboardRow);
|
$oPage->add("<td style=\"$sStyle\" class=\"$sCellClass\" data-dashboard-cell-index=\"$iCellIdx\">");
|
||||||
|
if (array_key_exists($iCellIdx, $aCells))
|
||||||
for ($iCols = 0; $iCols < $this->iNbCols; $iCols++) {
|
{
|
||||||
$oDashboardColumn = new DashboardColumn($bEditMode);
|
|
||||||
$oDashboardColumn->SetCellIndex($iCellIdx);
|
|
||||||
$oDashboardRow->AddDashboardColumn($oDashboardColumn);
|
|
||||||
|
|
||||||
if (array_key_exists($iCellIdx, $aCells)) {
|
|
||||||
$aDashlets = $aCells[$iCellIdx];
|
$aDashlets = $aCells[$iCellIdx];
|
||||||
if (count($aDashlets) > 0) {
|
if (count($aDashlets) > 0)
|
||||||
/** @var \Dashlet $oDashlet */
|
{
|
||||||
foreach ($aDashlets as $oDashlet) {
|
foreach($aDashlets as $oDashlet)
|
||||||
if ($oDashlet::IsVisible()) {
|
{
|
||||||
$oDashboardColumn->AddUIBlock($oDashlet->DoRender($oPage, $bEditMode, true /* bEnclosingDiv */, $aExtraParams));
|
if ($oDashlet->IsVisible())
|
||||||
|
{
|
||||||
|
$oDashlet->DoRender($oPage, $bEditMode, true /* bEnclosingDiv */, $aExtraParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$oDashboardColumn->AddUIBlock(new Html(' '));
|
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
$oDashboardColumn->AddUIBlock(new Html(' '));
|
{
|
||||||
|
$oPage->add(' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oPage->add(' ');
|
||||||
|
}
|
||||||
|
$oPage->add('</td>');
|
||||||
$iCellIdx++;
|
$iCellIdx++;
|
||||||
}
|
}
|
||||||
$sJSReload .= $oDashboardRow->GetJSRefreshCallback()." ";
|
$oPage->add('</tr>');
|
||||||
}
|
}
|
||||||
|
|
||||||
$oPage->add_script("function updateDashboard".$aExtraParams['dashboard_div_id']."(){".$sJSReload."}");
|
|
||||||
|
|
||||||
if ($bEditMode) // Add one row for extensibility
|
if ($bEditMode) // Add one row for extensibility
|
||||||
{
|
{
|
||||||
$oDashboardRow = new DashboardRow();
|
$sStyle = 'style="border: 1px #ccc dashed; width:'.$fColSize.'%;" class="layout_cell edit_mode layout_extension" data-dashboard-cell-index="'.$iCellIdx.'"';
|
||||||
$oDashboardLayout->AddDashboardRow($oDashboardRow);
|
$oPage->add('<tr>');
|
||||||
|
for($iCols = 0; $iCols < $this->iNbCols; $iCols++)
|
||||||
for ($iCols = 0; $iCols < $this->iNbCols; $iCols++) {
|
{
|
||||||
$oDashboardColumn = new DashboardColumn($bEditMode, true);
|
$oPage->add("<td $sStyle>");
|
||||||
$oDashboardRow->AddDashboardColumn($oDashboardColumn);
|
$oPage->add(' ');
|
||||||
$oDashboardColumn->AddUIBlock(new Html(' '));
|
$oPage->add('</td>');
|
||||||
}
|
}
|
||||||
|
$oPage->add('</tr>');
|
||||||
}
|
}
|
||||||
|
$oPage->add('</tbody></table>');
|
||||||
return $oDashboardLayout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function GetDashletCoordinates($iCellIdx)
|
|
||||||
{
|
|
||||||
$iColNumber = (int) $iCellIdx % $this->iNbCols;
|
|
||||||
$iRowNumber = (int) floor($iCellIdx / $this->iNbCols);
|
|
||||||
|
|
||||||
return array($iColNumber, $iRowNumber);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,836 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.2">
|
|
||||||
<classes>
|
|
||||||
<class id="AbstractResource" _delta="define">
|
|
||||||
<parent>cmdbAbstractObject</parent>
|
|
||||||
<properties>
|
|
||||||
<comment>/* Resource access control abstraction. Can be herited by abstract resource access control classes. Generaly controlled using UR_ACTION_MODIFY access right. */</comment>
|
|
||||||
<abstract>true</abstract>
|
|
||||||
</properties>
|
|
||||||
<presentation/>
|
|
||||||
<methods/>
|
|
||||||
</class>
|
|
||||||
<class id="ResourceAdminMenu" _delta="define">
|
|
||||||
<parent>AbstractResource</parent>
|
|
||||||
<properties>
|
|
||||||
<comment>/* AdminTools menu access control. */</comment>
|
|
||||||
<abstract>true</abstract>
|
|
||||||
<category>grant_by_profile</category>
|
|
||||||
</properties>
|
|
||||||
<presentation/>
|
|
||||||
<methods/>
|
|
||||||
</class>
|
|
||||||
<class id="ResourceRunQueriesMenu" _delta="define">
|
|
||||||
<parent>AbstractResource</parent>
|
|
||||||
<properties>
|
|
||||||
<comment>/* RunQueriesMenu menu access control. */</comment>
|
|
||||||
<abstract>true</abstract>
|
|
||||||
<category>grant_by_profile</category>
|
|
||||||
</properties>
|
|
||||||
<presentation/>
|
|
||||||
<methods/>
|
|
||||||
</class>
|
|
||||||
<class id="ResourceSystemMenu" _delta="define">
|
|
||||||
<parent>AbstractResource</parent>
|
|
||||||
<properties>
|
|
||||||
<comment>/* System menu access control. */</comment>
|
|
||||||
<abstract>true</abstract>
|
|
||||||
<category>grant_by_profile</category>
|
|
||||||
</properties>
|
|
||||||
<presentation/>
|
|
||||||
<methods/>
|
|
||||||
</class>
|
|
||||||
<class id="WelcomePopupAcknowledge" _delta="define">
|
|
||||||
<parent>DBObject</parent>
|
|
||||||
<properties>
|
|
||||||
<comment>/** Acknowledge welcome popup messages */</comment>
|
|
||||||
<abstract>false</abstract>
|
|
||||||
<category></category>
|
|
||||||
<key_type>autoincrement</key_type>
|
|
||||||
<db_table>priv_welcome_popup_acknowledge</db_table>
|
|
||||||
</properties>
|
|
||||||
<fields>
|
|
||||||
<field id="message_uuid" xsi:type="AttributeString">
|
|
||||||
<sql>message_uuid</sql>
|
|
||||||
<default_value/>
|
|
||||||
<is_null_allowed>false</is_null_allowed>
|
|
||||||
</field>
|
|
||||||
<field id="user_id" xsi:type="AttributeExternalKey">
|
|
||||||
<sql>user_id</sql>
|
|
||||||
<target_class>User</target_class>
|
|
||||||
<is_null_allowed>false</is_null_allowed>
|
|
||||||
<on_target_delete>DEL_SILENT</on_target_delete>
|
|
||||||
</field>
|
|
||||||
<field id="acknowledge_date" xsi:type="AttributeDateTime">
|
|
||||||
<sql>acknowledge_date</sql>
|
|
||||||
<default_value/>
|
|
||||||
<is_null_allowed>false</is_null_allowed>
|
|
||||||
</field>
|
|
||||||
</fields>
|
|
||||||
<presentation/>
|
|
||||||
<methods/>
|
|
||||||
</class>
|
|
||||||
</classes>
|
|
||||||
<portals>
|
|
||||||
<portal id="backoffice" _delta="define">
|
|
||||||
<url>pages/UI.php</url>
|
|
||||||
<rank>2.0</rank>
|
|
||||||
<handler/>
|
|
||||||
<allow/>
|
|
||||||
<deny>
|
|
||||||
<profile id="Portal user"/>
|
|
||||||
</deny>
|
|
||||||
</portal>
|
|
||||||
</portals>
|
|
||||||
<menus>
|
|
||||||
<menu id="WelcomeMenu" xsi:type="MenuGroup" _delta="define">
|
|
||||||
<rank>10</rank>
|
|
||||||
<style>
|
|
||||||
<decoration_classes>fas fa-home</decoration_classes>
|
|
||||||
</style>
|
|
||||||
</menu>
|
|
||||||
<menu id="WelcomeMenuPage" xsi:type="DashboardMenuNode" _delta="define">
|
|
||||||
<rank>10</rank>
|
|
||||||
<parent>WelcomeMenu</parent>
|
|
||||||
<definition>
|
|
||||||
<layout>DashboardLayoutOneCol</layout>
|
|
||||||
<title>Menu:WelcomeMenuPage</title>
|
|
||||||
<cells>
|
|
||||||
<cell id="0">
|
|
||||||
<rank>0</rank>
|
|
||||||
<dashlets>
|
|
||||||
</dashlets>
|
|
||||||
</cell>
|
|
||||||
</cells>
|
|
||||||
</definition>
|
|
||||||
</menu>
|
|
||||||
<menu id="MyShortcuts" xsi:type="ShortcutContainerMenuNode" _delta="define">
|
|
||||||
<rank>20</rank>
|
|
||||||
<parent>WelcomeMenu</parent>
|
|
||||||
</menu>
|
|
||||||
<menu id="UserManagement" xsi:type="TemplateMenuNode" _delta="define">
|
|
||||||
<rank>10</rank>
|
|
||||||
<parent>AdminTools</parent>
|
|
||||||
<template_file/>
|
|
||||||
</menu>
|
|
||||||
<menu id="UserAccountsMenu" xsi:type="OQLMenuNode" _delta="define">
|
|
||||||
<rank>11</rank>
|
|
||||||
<parent>UserManagement</parent>
|
|
||||||
<oql><![CDATA[SELECT User]]></oql>
|
|
||||||
<do_search>1</do_search>
|
|
||||||
<search_form_open>1</search_form_open>
|
|
||||||
<enable_class>User</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="ProfilesMenu" xsi:type="OQLMenuNode" _delta="define">
|
|
||||||
<rank>12</rank>
|
|
||||||
<parent>UserManagement</parent>
|
|
||||||
<oql><![CDATA[SELECT URP_Profiles]]></oql>
|
|
||||||
<do_search>1</do_search>
|
|
||||||
<enable_class>URP_Profiles</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="AuditCategories" xsi:type="OQLMenuNode" _delta="define">
|
|
||||||
<rank>20</rank>
|
|
||||||
<parent>AdminTools</parent>
|
|
||||||
<oql><![CDATA[SELECT AuditCategory]]></oql>
|
|
||||||
<do_search>1</do_search>
|
|
||||||
<enable_class>AuditCategory</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="Queries" xsi:type="TemplateMenuNode" _delta="define">
|
|
||||||
<rank>30</rank>
|
|
||||||
<parent>AdminTools</parent>
|
|
||||||
<template_file/>
|
|
||||||
</menu>
|
|
||||||
<menu id="RunQueriesMenu" xsi:type="WebPageMenuNode" _delta="define">
|
|
||||||
<rank>31</rank>
|
|
||||||
<parent>Queries</parent>
|
|
||||||
<url>$pages/run_query.php</url>
|
|
||||||
<enable_class>ResourceRunQueriesMenu</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="QueryMenu" xsi:type="OQLMenuNode" _delta="define">
|
|
||||||
<rank>32</rank>
|
|
||||||
<parent>Queries</parent>
|
|
||||||
<oql><![CDATA[SELECT Query]]></oql>
|
|
||||||
<do_search>1</do_search>
|
|
||||||
<enable_class>Query</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="ExportMenu" xsi:type="WebPageMenuNode" _delta="define">
|
|
||||||
<rank>33</rank>
|
|
||||||
<parent>Queries</parent>
|
|
||||||
<url>$webservices/export-v2.php?interactive=1</url>
|
|
||||||
<enable_class>ResourceAdminMenu</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="DataModelMenu" xsi:type="WebPageMenuNode" _delta="define">
|
|
||||||
<rank>40</rank>
|
|
||||||
<parent>AdminTools</parent>
|
|
||||||
<url>$pages/schema.php</url>
|
|
||||||
<enable_class>ResourceRunQueriesMenu</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="UniversalSearchMenu" xsi:type="WebPageMenuNode" _delta="define">
|
|
||||||
<rank>35</rank>
|
|
||||||
<parent>Queries</parent>
|
|
||||||
<url>$pages/UniversalSearch.php</url>
|
|
||||||
<enable_class>ResourceAdminMenu</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="ConfigurationTools" xsi:type="MenuGroup" _delta="define_if_not_exists">
|
|
||||||
<rank>90</rank>
|
|
||||||
<style>
|
|
||||||
<decoration_classes>fas fa-cog</decoration_classes>
|
|
||||||
</style>
|
|
||||||
</menu>
|
|
||||||
<menu id="Integrations" xsi:type="TemplateMenuNode" _delta="define">
|
|
||||||
<rank>50</rank>
|
|
||||||
<parent>ConfigurationTools</parent>
|
|
||||||
<template_file/>
|
|
||||||
</menu>
|
|
||||||
<menu id="DataSources" xsi:type="OQLMenuNode" _delta="define">
|
|
||||||
<rank>20</rank>
|
|
||||||
<parent>ConfigurationTools</parent>
|
|
||||||
<oql><![CDATA[SELECT SynchroDataSource]]></oql>
|
|
||||||
<do_search>1</do_search>
|
|
||||||
<enable_class>SynchroDataSource</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="NotificationsMenu" xsi:type="WebPageMenuNode" _delta="define">
|
|
||||||
<rank>40</rank>
|
|
||||||
<parent>ConfigurationTools</parent>
|
|
||||||
<url>$pages/notifications.php</url>
|
|
||||||
<enable_class>Trigger</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
</menu>
|
|
||||||
<menu id="AdminTools" xsi:type="MenuGroup" _delta="define">
|
|
||||||
<rank>80</rank>
|
|
||||||
<style>
|
|
||||||
<decoration_classes>fas fa-tools</decoration_classes>
|
|
||||||
</style>
|
|
||||||
</menu>
|
|
||||||
<menu id="SystemTools" xsi:type="MenuGroup" _delta="define">
|
|
||||||
<rank>100</rank>
|
|
||||||
<enable_class>ResourceSystemMenu</enable_class>
|
|
||||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
|
||||||
<style>
|
|
||||||
<decoration_classes>fas fa-terminal</decoration_classes>
|
|
||||||
</style>
|
|
||||||
</menu>
|
|
||||||
</menus>
|
|
||||||
<events>
|
|
||||||
<event id="EVENT_DB_BEFORE_WRITE" _delta="define">
|
|
||||||
<name>Before create or update</name>
|
|
||||||
<description><![CDATA[An object is about to be written into the database.
|
|
||||||
The object can be modified.]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<replaces>DBObject::OnInsert</replaces>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object inserted</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="is_new">
|
|
||||||
<description>Creation flag</description>
|
|
||||||
<type>boolean</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_CHECK_TO_WRITE" _delta="define">
|
|
||||||
<name>Check to write</name>
|
|
||||||
<description><![CDATA[Check an object before it is written into the database (no change possible).
|
|
||||||
Call $this->AddCheckIssue($sErrorMessage) to report a blocking issue.
|
|
||||||
Call $this->AddCheckWarning($sWarningMessage) to display a warning.
|
|
||||||
]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<replaces>cmdbAbstractObject::DoCheckToWrite</replaces>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object to check</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="is_new">
|
|
||||||
<description>Creation flag</description>
|
|
||||||
<type>boolean</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_AFTER_WRITE" _delta="define">
|
|
||||||
<name>After create or update</name>
|
|
||||||
<description><![CDATA[An object has been written into the database.
|
|
||||||
The modifications can be propagated to other objects.]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<replaces>DBObject::AfterInsert</replaces>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object inserted</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="is_new">
|
|
||||||
<description>Creation flag</description>
|
|
||||||
<type>boolean</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="changes">
|
|
||||||
<description><![CDATA[For updates, the list of changes done during this operation]]></description>
|
|
||||||
<type>array</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_CHECK_TO_DELETE" _delta="define">
|
|
||||||
<name>Check to delete</name>
|
|
||||||
<description><![CDATA[Check an object before it is deleted from the database.
|
|
||||||
Call $this->AddDeleteIssue($sIssueMessage) to signal an issue.]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<replaces>cmdbAbstractObject::DoCheckToDelete</replaces>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object to check</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_ABOUT_TO_DELETE" _delta="define">
|
|
||||||
<name>Before delete</name>
|
|
||||||
<description><![CDATA[An object is about to be deleted from the database]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<replaces>cmdbAbstractObject::OnDelete</replaces>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object about to be deleted</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_AFTER_DELETE" _delta="define">
|
|
||||||
<name>After delete</name>
|
|
||||||
<description><![CDATA[An object has been deleted into the database]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<replaces>DBObject::AfterDelete</replaces>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object deleted</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_ENUM_TRANSITIONS" _delta="define">
|
|
||||||
<name>Enum transitions</name>
|
|
||||||
<description><![CDATA[Manage the allowed transitions in current object state.
|
|
||||||
The only action allowed is to deny transitions with $this->DenyTransition($sTransitionCode)]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object where the stimulus is targeted</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="allowed_stimuli">
|
|
||||||
<description>The list of available stimuli in the current state</description>
|
|
||||||
<type>array</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_LINKS_CHANGED" _delta="define">
|
|
||||||
<name>Links on object have changed</name>
|
|
||||||
<description><![CDATA[At least one link class was changed]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object where the link is or was pointing to</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_OBJECT_RELOAD" _delta="define">
|
|
||||||
<name>Object reload</name>
|
|
||||||
<internal>true</internal>
|
|
||||||
<description><![CDATA[An object has been re-loaded from the database]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object re-loaded</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_COMPUTE_VALUES" _delta="define">
|
|
||||||
<name>Recompute object values</name>
|
|
||||||
<description><![CDATA[An object needs to be recomputed after changes]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<replaces>DBObject::ComputeValues</replaces>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object inserted</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_ARCHIVE" _delta="define">
|
|
||||||
<name>Object archived</name>
|
|
||||||
<description><![CDATA[An object has been archived]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object archived</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_UNARCHIVE" _delta="define">
|
|
||||||
<name>Object unarchived</name>
|
|
||||||
<description><![CDATA[An object has been unarchived]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object unarchived</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_SET_ATTRIBUTES_FLAGS" _delta="define">
|
|
||||||
<name>Set attributes flags</name>
|
|
||||||
<description><![CDATA[Set object attributes flags.
|
|
||||||
Call $this->AddAttributeFlags($sAttCode, $iFlags) for all the attributes to be set for this target state.]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The current object</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="target_state">
|
|
||||||
<description>The target state in which to evaluate the flags</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DB_SET_INITIAL_ATTRIBUTES_FLAGS" _delta="define">
|
|
||||||
<name>Set initial attributes flags</name>
|
|
||||||
<description><![CDATA[Set object initial attributes flags.
|
|
||||||
Call $this->AddInitialAttributeFlags($sAttCode, $iFlags) for all the initial attributes to be set initially.]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The current object</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_DOWNLOAD_DOCUMENT" _delta="define">
|
|
||||||
<name>Document downloaded</name>
|
|
||||||
<description><![CDATA[A document has been downloaded from the GUI]]></description>
|
|
||||||
<sources>
|
|
||||||
<source id="Document">Document</source>
|
|
||||||
</sources>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="object">
|
|
||||||
<description>The object containing the document</description>
|
|
||||||
<type>DBObject</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="att_code">
|
|
||||||
<description>The optional object attribute code hosting the document</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="document">
|
|
||||||
<description>The document downloaded</description>
|
|
||||||
<type>ormDocument</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="content_disposition">
|
|
||||||
<description>The content disposition of the document ("inline" or "attachment")</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="debug_info">
|
|
||||||
<description>Debug string</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
<event id="EVENT_LOGIN" _delta="define">
|
|
||||||
<name>Login</name>
|
|
||||||
<internal>true</internal>
|
|
||||||
<description><![CDATA[Inform the listeners about the connection states]]></description>
|
|
||||||
<event_data>
|
|
||||||
<event_datum id="code">
|
|
||||||
<description>The login step result code (LoginWebPage::EXIT_CODE_...) </description>
|
|
||||||
<type>integer</type>
|
|
||||||
</event_datum>
|
|
||||||
<event_datum id="state">
|
|
||||||
<description>Current login state (LoginWebPage::LOGIN_STATE_CONNECTED...)</description>
|
|
||||||
<type>string</type>
|
|
||||||
</event_datum>
|
|
||||||
</event_data>
|
|
||||||
</event>
|
|
||||||
</events>
|
|
||||||
<meta>
|
|
||||||
<classes>
|
|
||||||
<class id="cmdbAbstractObject" _delta="define">
|
|
||||||
<methods>
|
|
||||||
<method id="Set">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>deny</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeStopWatch"/>
|
|
||||||
<type id="AttributeSubItem"/>
|
|
||||||
<type id="AttributeExternalField"/>
|
|
||||||
<type id="AttributeLinkedSetIndirect"/>
|
|
||||||
<type id="AttributeLinkedSet"/>
|
|
||||||
<type id="AttributeImage"/>
|
|
||||||
<type id="AttributeBlob"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="2">
|
|
||||||
<type>string</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetIfNull">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>deny</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeStopWatch"/>
|
|
||||||
<type id="AttributeSubItem"/>
|
|
||||||
<type id="AttributeExternalField"/>
|
|
||||||
<type id="AttributeLinkedSetIndirect"/>
|
|
||||||
<type id="AttributeLinkedSet"/>
|
|
||||||
<type id="AttributeImage"/>
|
|
||||||
<type id="AttributeBlob"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="2">
|
|
||||||
<type>string</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="AddValue">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeInteger"/>
|
|
||||||
<type id="AttributeDecimal"/>
|
|
||||||
<type id="AttributePercentage"/>
|
|
||||||
<type id="AttributeDuration"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="2">
|
|
||||||
<type>string</type>
|
|
||||||
<mandatory>false</mandatory>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetComputedDate">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDate"/>
|
|
||||||
<type id="AttributeDateTime"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="2">
|
|
||||||
<type>string</type>
|
|
||||||
<mandatory>false</mandatory>
|
|
||||||
</argument>
|
|
||||||
<argument id="3">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>false</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDate"/>
|
|
||||||
<type id="AttributeDateTime"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetComputedDateIfNull">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDate"/>
|
|
||||||
<type id="AttributeDateTime"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="2">
|
|
||||||
<type>string</type>
|
|
||||||
<mandatory>false</mandatory>
|
|
||||||
</argument>
|
|
||||||
<argument id="3">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>false</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDate"/>
|
|
||||||
<type id="AttributeDateTime"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetCurrentDate">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDate"/>
|
|
||||||
<type id="AttributeDateTime"/>
|
|
||||||
<type id="AttributeString"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetCurrentDateIfNull">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDate"/>
|
|
||||||
<type id="AttributeDateTime"/>
|
|
||||||
<type id="AttributeString"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetCurrentUser">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeExternalKey"/>
|
|
||||||
<type id="AttributeInteger"/>
|
|
||||||
<type id="AttributeString"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetCurrentPerson">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeExternalKey"/>
|
|
||||||
<type id="AttributeInteger"/>
|
|
||||||
<type id="AttributeString"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="SetElapsedTime">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDuration"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="2">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeDate"/>
|
|
||||||
<type id="AttributeDateTime"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="3">
|
|
||||||
<type>string</type>
|
|
||||||
<mandatory>false</mandatory>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="Reset">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>deny</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeStopWatch"/>
|
|
||||||
<type id="AttributeSubItem"/>
|
|
||||||
<type id="AttributeExternalField"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="ResetStopWatch">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>allow</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeStopWatch"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="Copy">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
<type_restrictions>
|
|
||||||
<operation>deny</operation>
|
|
||||||
<types>
|
|
||||||
<type id="AttributeStopWatch"/>
|
|
||||||
<type id="AttributeSubItem"/>
|
|
||||||
<type id="AttributeExternalField"/>
|
|
||||||
</types>
|
|
||||||
</type_restrictions>
|
|
||||||
</argument>
|
|
||||||
<argument id="2">
|
|
||||||
<type>attcode</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
<method id="ApplyStimulus">
|
|
||||||
<arguments>
|
|
||||||
<argument id="1">
|
|
||||||
<type>string</type>
|
|
||||||
<mandatory>true</mandatory>
|
|
||||||
</argument>
|
|
||||||
</arguments>
|
|
||||||
</method>
|
|
||||||
</methods>
|
|
||||||
</class>
|
|
||||||
</classes>
|
|
||||||
</meta>
|
|
||||||
</itop_design>
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @deprecated 3.0.0 will be removed in 3.1.0 - moved to sources/Application/WebPage/ErrorPage.php, now loadable using autoloader
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
*/
|
|
||||||
|
|
||||||
DeprecatedCallsLog::NotifyDeprecatedFile('moved to sources/Application/WebPage/ErrorPage.php, now loadable using autoloader');
|
|
||||||
@@ -1,8 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Combodo\iTop\Application\WebPage\CLIPage;
|
|
||||||
use Combodo\iTop\Application\WebPage\Page;
|
|
||||||
|
|
||||||
require_once('xlsxwriter.class.php');
|
require_once('xlsxwriter.class.php');
|
||||||
|
|
||||||
class ExcelExporter
|
class ExcelExporter
|
||||||
@@ -466,7 +462,7 @@ class ExcelExporter
|
|||||||
$this->aAuthorizedClasses = array();
|
$this->aAuthorizedClasses = array();
|
||||||
foreach($aClasses as $sAlias => $sClassName)
|
foreach($aClasses as $sAlias => $sClassName)
|
||||||
{
|
{
|
||||||
if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) != UR_ALLOWED_NO)
|
if (UserRights::IsActionAllowed($sClassName, UR_ACTION_READ, $oSet) && (UR_ALLOWED_YES || UR_ALLOWED_DEPENDS))
|
||||||
{
|
{
|
||||||
$this->aAuthorizedClasses[$sAlias] = $sClassName;
|
$this->aAuthorizedClasses[$sAlias] = $sClassName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ApplicationException extends CoreException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Thrown when querying on an object that exists in the database but is archived
|
|
||||||
*
|
|
||||||
* @since 2.5.1 N°1108
|
|
||||||
*/
|
|
||||||
class ArchivedObjectException extends CoreException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
class BulkChangeException extends CoreException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
class CSVParserException extends CoreException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ConfigException extends CoreException
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
|
||||||
* @license http://opensource.org/licenses/AGPL-3.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CoreCannotSaveObjectException
|
|
||||||
*
|
|
||||||
* Specialized exception to raise if {@link DBObject::CheckToWrite()} fails, which allow easy data retrieval
|
|
||||||
*
|
|
||||||
* @see \DBObject::DBInsertNoReload()
|
|
||||||
* @see \DBObject::DBUpdate()
|
|
||||||
*
|
|
||||||
* @since 2.6.0 N°659 uniqueness constraint
|
|
||||||
*/
|
|
||||||
class CoreCannotSaveObjectException extends CoreException
|
|
||||||
{
|
|
||||||
/** @var string[] */
|
|
||||||
private $aIssues;
|
|
||||||
/** @var int */
|
|
||||||
private $iObjectId;
|
|
||||||
/** @var string */
|
|
||||||
private $sObjectClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CoreCannotSaveObjectException constructor.
|
|
||||||
*
|
|
||||||
* @param array $aContextData containing at least those keys : issues, id, class
|
|
||||||
*/
|
|
||||||
public function __construct($aContextData, $oPrevious = null)
|
|
||||||
{
|
|
||||||
$this->aIssues = $aContextData['issues'];
|
|
||||||
$this->iObjectId = $aContextData['id'];
|
|
||||||
$this->sObjectClass = $aContextData['class'];
|
|
||||||
|
|
||||||
$sIssues = implode(', ', $this->aIssues);
|
|
||||||
parent::__construct($sIssues, $aContextData, '', $oPrevious);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getHtmlMessage()
|
|
||||||
{
|
|
||||||
$sTitle = Dict::S('UI:Error:SaveFailed');
|
|
||||||
$sContent = "<span><strong>".utils::HtmlEntities($sTitle)."</strong></span>";
|
|
||||||
|
|
||||||
if (count($this->aIssues) == 1) {
|
|
||||||
$sIssue = reset($this->aIssues);
|
|
||||||
$sContent .= " <span>".utils::HtmlEntities($sIssue)."</span>";
|
|
||||||
} else {
|
|
||||||
$sContent .= '<ul>';
|
|
||||||
foreach ($this->aIssues as $sError) {
|
|
||||||
$sContent .= "<li>".utils::HtmlEntities($sError)."</li>";
|
|
||||||
}
|
|
||||||
$sContent .= '</ul>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTextMessage()
|
|
||||||
{
|
|
||||||
$sTitle = Dict::S('UI:Error:SaveFailed');
|
|
||||||
$sContent = utils::HtmlEntities($sTitle);
|
|
||||||
|
|
||||||
if (count($this->aIssues) == 1) {
|
|
||||||
$sIssue = reset($this->aIssues);
|
|
||||||
$sContent .= utils::HtmlEntities($sIssue);
|
|
||||||
} else {
|
|
||||||
foreach ($this->aIssues as $sError) {
|
|
||||||
$sContent .= " ".utils::HtmlEntities($sError).", ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $sContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function getIssues()
|
|
||||||
{
|
|
||||||
return $this->aIssues;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getObjectId()
|
|
||||||
{
|
|
||||||
return $this->iObjectId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getObjectClass()
|
|
||||||
{
|
|
||||||
return $this->sObjectClass;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user