~ubuntu-branches/debian/sid/pgadmin3/sid

« back to all changes in this revision

Viewing changes to pgadmin/frm/frmGrantWizard.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gerfried Fuchs
  • Date: 2009-07-30 12:27:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730122716-fddbh42on721bbs2
Tags: 1.10.0-1
* New upstream release.
* Adjusted watch file to match release candidates.
* Updated to Standards-Version 3.8.2:
  - Moved to Section: database.
  - Add DEB_BUILD_OPTIONS support for parallel building.
  - Move from findstring to filter suggestion for DEB_BUILD_OPTIONS parsing.
* pgagent got split into its own separate source package by upstream.
* Exclude Docs.vcproj from installation.
* Move doc-base.enus from pgadmin3 to pgadmin3-data package, the files are
  in there too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//////////////////////////////////////////////////////////////////////////
2
2
//
3
3
// pgAdmin III - PostgreSQL Tools
4
 
// RCS-ID:      $Id: frmGrantWizard.cpp 7321 2008-05-29 15:16:28Z dpage $
5
 
// Copyright (C) 2002 - 2008, The pgAdmin Development Team
6
 
// This software is released under the Artistic Licence
 
4
// RCS-ID:      $Id: frmGrantWizard.cpp 7758 2009-03-26 20:49:59Z dpage $
 
5
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
 
6
// This software is released under the BSD Licence
7
7
//
8
8
// frmGrantWizard.cpp - Grant Wizard dialogue
9
9
//
25
25
#include "schema/pgSequence.h"
26
26
#include "schema/pgTable.h"
27
27
#include "schema/pgView.h"
 
28
#include "schema/gpExtTable.h"
28
29
 
29
30
// Icons
30
31
#include "images/index.xpm"
135
136
            !factory->IsCollectionFor(triggerFunctionFactory) &&
136
137
            !factory->IsCollectionFor(procedureFactory) &&
137
138
            !factory->IsCollectionFor(viewFactory) &&
 
139
            !factory->IsCollectionFor(extTableFactory) &&
138
140
            !factory->IsCollectionFor(sequenceFactory))
139
141
            return;
140
142
    }
150
152
                AddObjects((pgCollection*)obj);
151
153
            else
152
154
            {
153
 
                                if (obj->CanEdit())
154
 
                                {
155
 
                                        objectArray.Add(obj);
156
 
                                        chkList->Append(obj->GetTypeName() + wxT(" ") + obj->GetFullIdentifier()); // no translation!
157
 
                                }
 
155
                if (obj->CanEdit())
 
156
                {
 
157
                    objectArray.Add(obj);
 
158
                    chkList->Append(obj->GetTypeName() + wxT(" ") + obj->GetFullIdentifier()); // no translation!
 
159
                }
158
160
            }
159
161
        }
160
162
        item=mainForm->GetBrowser()->GetNextChild(collection->GetId(), cookie);
167
169
    chkList->SetFocus();
168
170
 
169
171
    wxString privList = wxT("INSERT,SELECT,UPDATE,DELETE,RULE,REFERENCES,TRIGGER");
170
 
    char *privChar="arwdRxt";
 
172
    const char *privChar="arwdRxt";
171
173
    
172
174
    switch (object->GetMetaType())
173
175
    {
180
182
            privList = wxT("EXECUTE");
181
183
            privChar = "X";
182
184
            break;
 
185
        case GP_EXTTABLE:
 
186
            privList = wxT("SELECT,RULE");
 
187
            privChar = "r";
183
188
        default:
184
189
            break;
185
190
    }
253
258
            {
254
259
                case PGM_FUNCTION:
255
260
                {
256
 
                                        if (((pgFunction*)obj)->GetIsProcedure())
257
 
                                        {
258
 
                                                tmp = securityPage->GetGrant(wxT("X"), wxT("PROCEDURE ") 
259
 
                                                        + obj->GetQuotedFullIdentifier() + wxT("(")
260
 
                                                        + ((pgProcedure*)obj)->GetArgSigList() + wxT(")"));
261
 
                                        }
262
 
                                        else
263
 
                                        {
264
 
                                                tmp = securityPage->GetGrant(wxT("X"), wxT("FUNCTION ") 
265
 
                                                        + obj->GetQuotedFullIdentifier() + wxT("(")
266
 
                                                        + ((pgFunction*)obj)->GetArgSigList() + wxT(")"));
267
 
                                        }
 
261
                    if (((pgFunction*)obj)->GetIsProcedure())
 
262
                    {
 
263
                        tmp = securityPage->GetGrant(wxT("X"), wxT("PROCEDURE ") 
 
264
                            + obj->GetQuotedFullIdentifier() + wxT("(")
 
265
                            + ((pgProcedure*)obj)->GetArgSigList() + wxT(")"));
 
266
                    }
 
267
                    else
 
268
                    {
 
269
                        tmp = securityPage->GetGrant(wxT("X"), wxT("FUNCTION ") 
 
270
                            + obj->GetQuotedFullIdentifier() + wxT("(")
 
271
                            + ((pgFunction*)obj)->GetArgSigList() + wxT(")"));
 
272
                    }
268
273
                    break;
269
274
                }
270
275
                case PGM_VIEW:
271
276
                case PGM_SEQUENCE:
272
277
                    tmp = securityPage->GetGrant(wxT("arwdRxt"), wxT("TABLE ") + obj->GetQuotedFullIdentifier());
273
278
                    break;
 
279
                case GP_EXTTABLE:
 
280
                    tmp = securityPage->GetGrant(wxT("r"), wxT("TABLE ") + obj->GetQuotedFullIdentifier());
274
281
                default:
275
 
                    tmp = securityPage->GetGrant(wxT("arwdRxt"), obj->GetTypeName().Upper() + wxT(" ") + obj->GetQuotedFullIdentifier());
 
282
                    if (obj->GetTypeName().Upper() == wxT("EXTERNAL TABLE")) // somewhat of a hack
 
283
                    {
 
284
                         tmp = securityPage->GetGrant(wxT("r"), wxT("TABLE ") + obj->GetQuotedFullIdentifier());
 
285
                    }
 
286
                    else
 
287
                        tmp = securityPage->GetGrant(wxT("arwdRxt"), obj->GetTypeName().Upper() + wxT(" ") + obj->GetQuotedFullIdentifier());
276
288
                    break;
277
289
            }
278
290
 
284
296
}
285
297
 
286
298
 
287
 
grantWizardFactory::grantWizardFactory(menuFactoryList *list, wxMenu *mnu, wxToolBar *toolbar) : contextActionFactory(list)
 
299
grantWizardFactory::grantWizardFactory(menuFactoryList *list, wxMenu *mnu, ctlMenuToolbar *toolbar) : contextActionFactory(list)
288
300
{
289
301
    mnu->Append(id, _("&Grant Wizard"), _("Grants rights to multiple objects"));
290
302
}
308
320
            case PGM_FUNCTION:
309
321
            case PGM_SEQUENCE:
310
322
            case PGM_VIEW:
311
 
                                if (obj->IsCollection() && obj->GetSchema()->GetMetaType() != PGM_CATALOG)
312
 
                                        return obj->GetSchema()->CanEdit();
313
 
                                break;
 
323
            case GP_EXTTABLE:
 
324
                if (obj->IsCollection() && obj->GetSchema()->GetMetaType() != PGM_CATALOG)
 
325
                    return obj->GetSchema()->CanEdit();
 
326
                break;
314
327
 
315
 
                        case PGM_SCHEMA:
316
 
                                        return obj->CanEdit();
 
328
            case PGM_SCHEMA:
 
329
                    return obj->CanEdit();
317
330
            default:
318
331
                break;
319
332
        }