Is there anything in the API to make it nicer to move from the old, fixed realm numbers to dynamically allocated ones?
I can't see how I can migrate old permissions with confidence that I'm not just rewriting some other plugins permissions - I know that weathermap used to use 42 and 43.
If I get allocated a dynamic realm number, how do I know that the 42 and 43 in the user's system are old weathermap permissions and not some other plugin's dynamic realm?
The alternative is not to migrate them at all, which makes the user suffer for something that's not their fault.
Migration from old to new API - user realms
Moderators: Developers, Moderators
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Migration from old to new API - user realms
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
In snmptt plugin I use this to check snmptt admin realms status :
Code: Select all
function is_snmptt_admin () {
global $user_auth_realm_filenames;
$rezult = 0;
//get snmptt Plugin -> SNMPTT: Manage Realm ID
$snmptt_admin_realm_id = db_fetch_cell("SELECT `id`+100 FROM `plugin_realms` where `display` like 'plugin%snmptt%manage%'");
if (isset($snmptt_admin_realm_id)) {
//Check this user - for snmptt admin realms
if ((db_fetch_assoc("select user_auth_realm.realm_id from user_auth_realm
where user_auth_realm.user_id='" . $_SESSION["sess_user_id"] . "'
and user_auth_realm.realm_id='$snmptt_admin_realm_id'")) && (!empty($snmptt_admin_realm_id))) {
$rezult = 1;
}
}
return $rezult;
}
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
But that also doesn't check that it isn't already in use by another plugin.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
1. I think is made specially for this purpose what not to be crossed with old realms
2. Why You need to know who uses old realmID ? After installing new version of Weathermap with PA 2.x admin must recheck users permission and new realmID will be added.
Code: Select all
`id`+100
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
[size=75]Sorry for my English. [/size]
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
No, that only finds a realm 100 above the other one. You don't check if it's already in use. Some plugins use large fixed numbers to try and avoid clashes too. Most of the time you will be lucky, but it's not right.gthe wrote:1. I think is made specially for this purpose what not to be crossed with old realmsCode: Select all
`id`+100
I see that as a failure. Suppose the user has set up hundreds of users... why should they be forced to repeat that work?2. Why You need to know who uses old realmID ? After installing new version of Weathermap with PA 2.x admin must recheck users permission and new realmID will be added.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
But even if you find unused realmID for install pia2.x plugin - there are no guarantees that then in future user don't install old plugin with you new realmID.Howie wrote:No, that only finds a realm 100 above the other one. You don't check if it's already in use. Some plugins use large fixed numbers to try and avoid clashes too. Most of the time you will be lucky, but it's not right.gthe wrote:1. I think is made specially for this purpose what not to be crossed with old realmsCode: Select all
`id`+100
I think it is a way go away from using realmID.Howie wrote:I see that as a failure. Suppose the user has set up hundreds of users... why should they be forced to repeat that work?2. Why You need to know who uses old realmID ? After installing new version of Weathermap with PA 2.x admin must recheck users permission and new realmID will be added.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
[size=75]Sorry for my English. [/size]
- phalek
- Developer
- Posts: 2838
- Joined: Thu Jan 31, 2008 6:39 am
- Location: Kressbronn, Germany
- Contact:
I guess it would be first sufficient if there was a table containing all used realm ids, maybe also some process for actually requesting fixed IDs ?
Kindof:
1-1000 reserverd
1000-5000 realmid needs to be registered centrally
5000-6000 realmids that can be freely used but maybe overwritten by other plugins
?
Other than that, dynamic would be to use the MAX(ID)+1 statement, I guess?
Kindof:
1-1000 reserverd
1000-5000 realmid needs to be registered centrally
5000-6000 realmids that can be freely used but maybe overwritten by other plugins
?
Other than that, dynamic would be to use the MAX(ID)+1 statement, I guess?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
Who is online
Users browsing this forum: No registered users and 5 guests