@@ -32,6 +32,8 @@ class PluginDatabaseinventoryProfile extends Profile
3232{
3333 public static $ rightname = 'profile ' ;
3434
35+ const RUN_DATABSE_INVENTORY = 256 ;
36+
3537 public static function getTypeName ($ nb = 0 )
3638 {
3739 return __ ('Database Inventory ' , 'databaseinventory ' );
@@ -41,15 +43,31 @@ private static function getAllRights($all = false)
4143 {
4244 $ rights = [
4345 [
44- 'itemtype ' => PluginDatabaseinventoryDatabaseParam::getType (),
45- 'label ' => PluginDatabaseinventoryProfile::getTypeName (),
46- 'field ' => 'database_inventory ' ,
46+ 'itemtype ' => PluginDatabaseinventoryDatabaseParam::getType (),
47+ 'label ' => PluginDatabaseinventoryProfile::getTypeName (),
48+ 'field ' => 'database_inventory ' ,
49+ 'rights ' => [
50+ CREATE => __ ('Create ' ),
51+ READ => __ ('Read ' ),
52+ UPDATE => __ ('Update ' ),
53+ PURGE => ['short ' => __ ('Purge ' ),
54+ 'long ' => _x ('button ' , 'Delete permanently ' ),
55+ ],
56+ self ::RUN_DATABSE_INVENTORY => __ ("Run database inventory " , "databaseinventory " ),
57+ ],
4758 ],
4859 ];
4960
5061 return $ rights ;
5162 }
5263
64+ function getRights ($ interface = 'central ' )
65+ {
66+ $ rights = parent ::getRights ();
67+ $ rights [self ::RUN_DATABSE_INVENTORY ] = __ ("Run database inventory " , "databaseinventory " );
68+ return $ rights ;
69+ }
70+
5371 public function getTabNameForItem (CommonGLPI $ item , $ withtemplate = 0 )
5472 {
5573 if ($ item ->getType () == 'Profile ' ) {
@@ -96,10 +114,10 @@ private static function showForProfile($profiles_id = 0)
96114 public static function install (Migration $ migration )
97115 {
98116 // Add right for administrators
99- $ migration ->addRight ('database_inventory ' , PURGE + CREATE + UPDATE + READ , ['config ' => UPDATE ]);
117+ $ migration ->addRight ('database_inventory ' , PURGE + CREATE + UPDATE + READ + self :: RUN_DATABSE_INVENTORY , ['config ' => UPDATE ]);
100118
101119 // Add right to the current session
102- $ _SESSION ['glpiactiveprofile ' ]['database_inventory ' ] = PURGE + CREATE + UPDATE + READ ;
120+ $ _SESSION ['glpiactiveprofile ' ]['database_inventory ' ] = PURGE + CREATE + UPDATE + READ + self :: RUN_DATABSE_INVENTORY ;
103121
104122 return true ;
105123 }
0 commit comments