#include <profiles.h>
Inheritance diagram for PROFILES:

Public Methods | |
| PROFILES (const char *path) | |
| PROFILES (const char *path, const char *id) | |
| PROFILES (void) | |
| int | add (CONFDB *db) |
| int | add (const char *id) |
| int | del (void) |
| int | dia_admin (void) |
| int | dia_list (DIALOG&dia, SSTRINGS&tb) |
| int | dia_select (void) |
| CONFDB* | get (const char *id) |
| int | get_list (SSTRINGS&lst) |
| void | reset (void) |
| int | setpath (const char *id) |
| void | setup_priv (PRIVILEGES&priv_tb, const char *section) |
| int | use (const char *id) |
| ~PROFILES (void) | |
Public Attributes | |
| SSTRING | path |
| SSTRING | id |
| PROFILE | profile |
|
|
Definition at line 149 of file profiles.cc. 00150 {
00151 this->path.setfrom(path);
00152 }
|
|
|
Definition at line 154 of file profiles.cc. 00155 {
00156 this->path.setfrom(path);
00157 this->id.setfrom(id);
00158 }
|
|
|
Definition at line 133 of file profiles.cc. 00134 {
00135 }
|
|
|
Definition at line 137 of file profiles.cc. 00138 {
00139 this->reset();
00140 }
|
|
|
Definition at line 198 of file profiles.cc. Referenced by bindprofile_edit(), dia_admin(), and profile_edit(). 00199 {
00200 int ret;
00201 char name[PATH_MAX];
00202 if (dialog_inputbox(MSG_U(T_NEWPROFILE,"New profile")
00203 ,MSG_U(I_NEWPROFILE,"Enter name for new profile")
00204 ,help_profiles,name)==MENU_ACCEPT){
00205 ret = setpath(name);
00206 /*
00207 if (this->profile.file->exist) // Check if profilename is used
00208 ret = -1;
00209 else {
00210 */
00211 for (int n = 0 ; n < db->getnb(); n++) { // Copy profile
00212 CONFOBJ record(*db->getitem(n));
00213 char buf[256];
00214 sprintf(buf,"%s %s",record.key.get(),record.val.get());
00215 this->profile.data->addline(buf);
00216 }
00217 this->profile.data->save();
00218
00219 xconf_notice(MSG_U(N_PROFILE_CREATED,"Profile created"));
00220 ret = 1;
00221 }
00222 else {
00223 xconf_error(MSG_U(E_PROFILE_EXIST,"Profile not created"));
00224 ret = 0;
00225 }
00226
00227 return ret;
00228 }
|
|
|
Definition at line 186 of file profiles.cc. 00187 {
00188 int ret = setpath(id);
00189 return ret;
00190 }
|
|
|
Definition at line 236 of file profiles.cc. Referenced by bindprofile_edit(), and profile_edit(). 00236 {
00237 int ret = 0;
00238 if (xconf_delok()){
00239 if (this->profile.file->unlink() != 0) {
00240 xconf_error(MSG_U(E_DELPROFILE,"Error deleting profile"));
00241 }else{
00242 xconf_notice(MSG_U(N_DELPROFILE,"Profile deleted"));
00243 ret = 1;
00244 }
00245 }
00246 return ret;
00247 }
|
|
|
Definition at line 355 of file profiles.cc. Referenced by bindprofile_edit(), formprofile_edit(), and profile_edit(). 00356 {
00357 D(debugf(6,"PROFILES::dia_admin \n"));
00358
00359 int ret = -1;
00360 DIALOG_LISTE dia;
00361 SSTRINGS tb;
00362 dia.newf_head ("",id.get());
00363 dia_list(dia,tb);
00364 int nof = 0;
00365
00366 while (1){
00367 MENU_STATUS code = dia.editmenu (MSG_U(T_PROFILES_ADMIN,"Profiles")
00368 ,MSG_U(I_PROFILES_ADMIN,"Select profile to edit, or add a new")
00369 ,help_profiles
00370 ,nof
00371 ,MENUBUT_ADD);
00372 if (code == MENU_QUIT || code == MENU_ESCAPE){
00373 ret = -1;
00374 break;
00375 } else if (code == MENU_ADD ){
00376 char name[100];
00377 if (dialog_inputbox(MSG_U(T_PROFILES_ADMIN_ADD,"New profile")
00378 ,MSG_U(I_PROFILES_ADMIN_ADD,"Enter name of the new profile")
00379 ,help_profiles,name)==MENU_ACCEPT){
00380 this->add(name);
00381 profile.id.setfrom(name);
00382 this->use(name);
00383 ret = 0;
00384 break;
00385 }
00386 }else if (nof >=0 && nof < tb.getnb()){
00387 profile.id.setfrom(tb.getitem(nof)->get());
00388 this->use(profile.id.get());
00389 ret = nof;
00390 break;
00391 }
00392 }
00393 return ret;
00394 }
|
|
|
Definition at line 302 of file profiles.cc. Referenced by dia_admin(), and dia_select(). 00303 {
00304 int n = get_list(tb);
00305 for (int i=0; i<n; i++){
00306 // if (check_perm(tb.getitem(i)->get()))
00307 // {
00308 dia.set_menuitem (i,tb.getitem(i)->get(),"");
00309 // }
00310 }
00311 return n;
00312 }
|
|
|
Definition at line 320 of file profiles.cc. Referenced by profile_select(). 00321 {
00322 int ret = -1;
00323 DIALOG_LISTE dia;
00324 SSTRINGS tb;
00325 dia.newf_head ("",id.get());
00326 int nof = 0;
00327
00328 while (1){
00329 dia_list(dia,tb);
00330
00331 MENU_STATUS code = dia.editmenu (MSG_U(T_PROFILES_SELECT,"Profiles")
00332 ,MSG_U(I_PROFILES_SELECT,"Select profile to use")
00333 ,help_profiles
00334 ,nof
00335 ,0);
00336 if (code == MENU_QUIT || code == MENU_ESCAPE){
00337 break;
00338 }else if (nof >=0 && nof < tb.getnb()){
00339 profile.id.setfrom(tb.getitem(nof)->get());
00340 this->use(profile.id.get());
00341 ret = nof;
00342 break;
00343 }
00344 }
00345 return ret;
00346 }
|
|
|
Definition at line 286 of file profiles.cc. Referenced by add(). 00287 {
00288 CONFDB *ret;
00289
00290 this->setpath(id);
00291 ret = profile.data;
00292
00293 return ret;
00294 }
|
|
|
Definition at line 172 of file profiles.cc. Referenced by dia_list(), profile_edit(), and setup_priv(). 00173 {
00174 dir_getfiltered (path.get(),lst,".OLD .rpmorig .rpmsave .rpmnew ~"); // Ignore the specified extensions
00175 lst.sort();
00176 return lst.getnb();
00177 }
|
|
|
Definition at line 160 of file profiles.cc. Referenced by ~PROFILES(). 00160 {
00161 this->profile.reset();
00162 }
|
|
|
Definition at line 255 of file profiles.cc. Referenced by add(), get(), and use(). 00256 {
00257 int ret = 0;
00258
00259 char f_path[PATH_MAX];
00260 snprintf(f_path,sizeof(f_path)-1,"%s/%s",this->path.get(),id);
00261 ret = this->profile.setfile(f_path);
00262 profile.id.setfrom(id);
00263
00264 return ret;
00265 }
|
|
|
Definition at line 402 of file profiles.cc. 00403 {
00404 D(debugf(6,"PROFILES::set_privi section = %s \n",section));
00405 SSTRINGS profiles_tb;
00406
00407 priv_tb.remove_all();
00408
00409 int n = this->get_list(profiles_tb);
00410 for (int i=0; i<n; i++){
00411 const char *id = profiles_tb.getitem(i)->get();
00412 char priv_id[PATH_MAX];
00413 sprintf (priv_id,"profile_%s",id);
00414 priv_tb.add (new PRIVILEGE (priv_id,id,section));
00415 }
00416 }
|
|
|
Definition at line 273 of file profiles.cc. Referenced by dia_admin(), and dia_select(). |
|
|
Definition at line 26 of file profiles.h. |
|
|
Definition at line 27 of file profiles.h. |
|
|
Definition at line 28 of file profiles.h. |
1.2.1 written by Dimitri van Heesch,
© 1997-2000