summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui
diff options
context:
space:
mode:
authorOcke Janssen <oj@openoffice.org>2001-06-20 11:30:48 +0000
committerOcke Janssen <oj@openoffice.org>2001-06-20 11:30:48 +0000
commit9ad18150a10f0f61300c0d458f2d403ab9fadbb3 (patch)
treeb5cf062c35f73a5adc16e00b1de91f35dd70dd92 /dbaccess/source/ui
parent0c8628a10ed6f845e35d74f69fb145b3cbcf1d92 (diff)
#88434# some access changes
Diffstat (limited to 'dbaccess/source/ui')
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.cxx45
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.hxx6
-rw-r--r--dbaccess/source/ui/dlg/UserAdmin.src38
-rw-r--r--dbaccess/source/ui/inc/TableGrantCtrl.hxx24
4 files changed, 65 insertions, 48 deletions
diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx
index cff76a085bcb..472a4ddd2d7f 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.cxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: UserAdmin.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-06-20 07:00:42 $
+ * last change: $Author: oj $ $Date: 2001-06-20 12:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -113,6 +113,9 @@
#ifndef _DBAUI_MODULE_DBU_HXX_
#include "moduledbu.hxx"
#endif
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
@@ -135,8 +138,6 @@ OUserAdmin::OUserAdmin(Window* pParent,const SfxItemSet& _rAttrSet)
,m_PB_DELETEUSER( this , ResId(PB_DELETEUSER))
,m_FL_TABLE_GRANTS( this , ResId(FL_TABLE_GRANTS))
,m_TableCtrl( this , ResId(CTRL_TABLE_GRANTS))
- ,m_bSysDba(FALSE)
- ,m_bDba(FALSE)
,m_pAdminDialog(NULL)
{
DBG_CTOR(OUserAdmin,NULL);
@@ -152,6 +153,7 @@ OUserAdmin::OUserAdmin(Window* pParent,const SfxItemSet& _rAttrSet)
OUserAdmin::~OUserAdmin()
{
DBG_DTOR(OUserAdmin,NULL);
+ ::comphelper::disposeComponent(m_xConnection);
}
// -----------------------------------------------------------------------
void OUserAdmin::FillUserNames()
@@ -172,21 +174,31 @@ void OUserAdmin::FillUserNames()
m_aUserNames = m_xUsers->getElementNames();
const ::rtl::OUString* pBegin = m_aUserNames.getConstArray();
const ::rtl::OUString* pEnd = pBegin + m_aUserNames.getLength();
+ ::rtl::OUString sUserName = m_UserName;
for(;pBegin != pEnd;++pBegin)
{
- m_LB_USER.InsertEntry(*pBegin);
+ // the user which is connected to the database should be in the list because
+ // he doesn't have the possibility to revoke his own rights
+ if(sUserName != *pBegin)
+ m_LB_USER.InsertEntry(*pBegin);
}
m_LB_USER.SelectEntryPos(0);
+ if(m_xUsers->hasByName(m_UserName))
+ {
+ Reference<XAuthorizable> xAuth;
+ m_xUsers->getByName(m_UserName) >>= xAuth;
+ m_TableCtrl.setGrantUser(xAuth);
+ }
m_TableCtrl.setUserName(GetUser());
m_TableCtrl.Init();
}
-// if(!(m_bSysDba || m_bDba))
-// {
-// m_PB_NEWUSER.Enable(FALSE);
-// m_PB_DELETEUSER.Enable(FALSE);
-// }
+
+ Reference<XAppend> xAppend(m_xUsers,UNO_QUERY);
+ m_PB_NEWUSER.Enable(xAppend.is());
+ Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
+ m_PB_DELETEUSER.Enable(xDrop.is());
}
// -----------------------------------------------------------------------
SfxTabPage* OUserAdmin::Create( Window* pParent, const SfxItemSet& _rAttrSet )
@@ -240,12 +252,13 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
String aName = GetUser();
SfxPasswordDialog aPwdDlg(this,&aName);
- aPwdDlg.ShowExtras(SHOWEXTRAS_NONE);
+ aPwdDlg.ShowExtras(SHOWEXTRAS_USER);
if(aPwdDlg.Execute())
{
String sOldPwd = aPwdDlg.GetPassword();
- aPwdDlg.ShowExtras(SHOWEXTRAS_CONFIRM);
- if(aPwdDlg.Execute() && m_xUsers->hasByName(GetUser()))
+ SfxPasswordDialog aPwdDlg2(this,&aName);
+ aPwdDlg2.ShowExtras(SHOWEXTRAS_CONFIRM);
+ if(aPwdDlg2.Execute() && m_xUsers->hasByName(GetUser()))
{
Reference<XUser> xUser;
m_xUsers->getByName(GetUser()) >>= xUser;
@@ -260,7 +273,11 @@ IMPL_LINK( OUserAdmin, UserHdl, PushButton *, pButton )
{
Reference<XDrop> xDrop(m_xUsers,UNO_QUERY);
if(xDrop.is())
- xDrop->dropByName(GetUser());
+ {
+ QueryBox aQry(this, ModuleRes(QUERY_USERADMIN_DELETE_USER));
+ if(aQry.Execute() == RET_YES)
+ xDrop->dropByName(GetUser());
+ }
}
}
}
diff --git a/dbaccess/source/ui/dlg/UserAdmin.hxx b/dbaccess/source/ui/dlg/UserAdmin.hxx
index d41bc860fc60..2100f823a213 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.hxx
+++ b/dbaccess/source/ui/dlg/UserAdmin.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: UserAdmin.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-06-20 07:00:50 $
+ * last change: $Author: oj $ $Date: 2001-06-20 12:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -109,8 +109,6 @@ protected:
String m_UserName;
ODbAdminDialog* m_pAdminDialog;
- BOOL m_bSysDba; // true if i am SYSDBA user else false
- BOOL m_bDba;
// methods
DECL_LINK( ListDblClickHdl, ListBox * );
diff --git a/dbaccess/source/ui/dlg/UserAdmin.src b/dbaccess/source/ui/dlg/UserAdmin.src
index 2436480c54f0..920696cf2f58 100644
--- a/dbaccess/source/ui/dlg/UserAdmin.src
+++ b/dbaccess/source/ui/dlg/UserAdmin.src
@@ -2,9 +2,9 @@
*
* $RCSfile: UserAdmin.src,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: oj $ $Date: 2001-06-20 07:00:35 $
+ * last change: $Author: oj $ $Date: 2001-06-20 12:30:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -151,26 +151,9 @@ TabPage TAB_PAGE_USERADMIN
TabStop = TRUE ;
DefButton = TRUE ;
HelpId = HID_TAB_PAGE_PBUSER ;
- Text = "~Neuer Benutzer...";
- Text[ENGLISH] = "~New user...";
- Text[ english_us ] = "~New user...";
- Text[ portuguese ] = "~Novo utilizador...";
- Text[ russian ] = " ...";
- Text[ greek ] = " ...";
- Text[ dutch ] = "~Nieuwe gebruiker...";
- Text[ french ] = "~Nouvel utilisateur...";
- Text[ spanish ] = "~Nuevo usuario...";
- Text[ italian ] = "~Nuovo utente...";
- Text[ danish ] = "Ny bruger...";
- Text[ swedish ] = "~Ny anvndare...";
- Text[ polish ] = "Nowy uytkownik...";
- Text[ portuguese_brazilian ] = "~New user...";
- Text[ japanese ] = "Vհް(~N)...";
- Text[ korean ] = " (~N)...";
- Text[ chinese_simplified ] = "ʹ(~N)...";
- Text[ chinese_traditional ] = "sWϥΪ(~N)...";
- Text[ arabic ] = " ...";
- Text[ turkish ] = "Yeni kullanc...";
+ Text = "Benutzer ~hinzufgen...";
+ Text[ENGLISH] = "~User add...";
+ Text[ english_us ] = "~User add...";
};
PushButton PB_CHANGEPWD
@@ -235,8 +218,8 @@ TabPage TAB_PAGE_USERADMIN
{
Pos = MAP_APPFONT ( 6 , 52 ) ;
Size = MAP_APPFONT ( WINDOW_SIZE_X - 8, 8) ;
- Text = "Benutzerrechte fr ausgewhlten Benutzer" ;
- Text [ ENGLISH ] = "User rights for choosen user" ;
+ Text = "Zugriffsrechte fr ausgewhlten Benutzer" ;
+ Text [ ENGLISH ] = "Access rights for choosen user" ;
Text[ english_us ] = "Access rights for user selected";
Text[ portuguese ] = "Direitos de acesso para utilizador seleccionado";
Text[ russian ] = " ";
@@ -267,3 +250,10 @@ TabPage TAB_PAGE_USERADMIN
};
};
+QueryBox QUERY_USERADMIN_DELETE_USER
+{
+ Buttons = WB_YES_NO ;
+ Message = "Soll der Benutzer wirklich gelscht werden?" ;
+ Message [ English ] = "Do you really want to delete the select user?" ;
+};
+
diff --git a/dbaccess/source/ui/inc/TableGrantCtrl.hxx b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
index 39b6f3a968d0..4f51a1e7ff70 100644
--- a/dbaccess/source/ui/inc/TableGrantCtrl.hxx
+++ b/dbaccess/source/ui/inc/TableGrantCtrl.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: TableGrantCtrl.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: rt $ $Date: 2001-06-20 11:25:11 $
+ * last change: $Author: oj $ $Date: 2001-06-20 12:27:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,6 +67,9 @@
#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
#endif
+#ifndef _COM_SUN_STAR_SDBCX_XAUTHORIZABLE_HPP_
+#include <com/sun/star/sdbcx/XAuthorizable.hpp>
+#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
@@ -80,14 +83,21 @@ namespace dbaui
class OTableGrantControl : public DbBrowseBox
{
- DECLARE_STL_USTRINGACCESS_MAP(sal_Int32,TTablePrivilegeMap);
+ typedef struct
+ {
+ sal_Int32 nRights;
+ sal_Int32 nWithGrant;
+ } TPrivileges;
+
+ DECLARE_STL_USTRINGACCESS_MAP(TPrivileges,TTablePrivilegeMap);
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUsers;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xTables;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable> m_xGrantUser;
::com::sun::star::uno::Sequence< ::rtl::OUString> m_aTableNames;
- TTablePrivilegeMap m_aPrivMap;
+ mutable TTablePrivilegeMap m_aPrivMap;
::rtl::OUString m_sUserName;
DbCheckBoxCtrl* m_pCheckCell;
Edit* m_pEdit;
@@ -99,6 +109,7 @@ public:
virtual ~OTableGrantControl();
void UpdateTables();
void setUserName(const ::rtl::OUString _sUserName);
+ void setGrantUser(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XAuthorizable>& _xGrantUser);
void setTablesSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier >& _xTablesSup);
void setORB(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xORB);
@@ -124,8 +135,9 @@ private:
DECL_LINK( AsynchActivate, void* );
DECL_LINK( AsynchDeactivate, void* );
- sal_Bool isAllowed(USHORT _nColumnId,sal_Int32 _nPrivilege) const;
- sal_Int32 fillPrivilege(sal_Int32 _nRow);
+ sal_Bool isAllowed(USHORT _nColumnId,sal_Int32 _nPrivilege) const;
+ void fillPrivilege(sal_Int32 _nRow) const;
+ TTablePrivilegeMap::const_iterator findPrivilege(sal_Int32 _nRow) const;
};
}