Question sql

morticiancorax Messages postés 27 Date d'inscription dimanche 28 février 2010 Statut Membre Dernière intervention 18 mai 2010 - 23 avril 2010 à 17:42
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 - 23 avril 2010 à 23:08
salut!
est ce que on peux empecher l'utilisateur de suprimer des donnés de labase de don"e avec une requette sql???
cadne lui pas permettre de suprimer ou meme de modifier une ligne dans la base car on a besoin d' un champ (par exemple le nom qui sera utilser une autre fois dans un programe)
merci

3 réponses

cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 131
23 avril 2010 à 17:51
Salut,

C'est quel type de base de données ? DB2 ?
______________________________________

AVANT de poster votre message, veuillez lire, comprendre, et appliquer notre réglement
0
morticiancorax Messages postés 27 Date d'inscription dimanche 28 février 2010 Statut Membre Dernière intervention 18 mai 2010
23 avril 2010 à 23:00
salut,
oui..
0
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 131
23 avril 2010 à 23:08
Salut,

Je n'ai jamais administré une base DB2, mais pour le principe, il te faut créer un utilisateur, et ne pas lui donner les droits de modification et de suppression.

Exemple :
The following example grants SELECT privileges on the EMPLOYEE table to the user HERON:

GRANT SELECT ON EMPLOYEE TO USER HERON

The following example grants SELECT privileges on the EMPLOYEE table to the group HERON:

GRANT SELECT ON EMPLOYEE TO GROUP HERON

GRANT SELECT,UPDATE ON TABLE STAFF TO GROUP PERSONNL

If a privilege has been granted to both a user and a group with the same name, you must specify the GROUP or USER keyword when revoking the privilege. The following example revokes the SELECT privilege on the EMPLOYEE table from the user HERON:

REVOKE SELECT ON EMPLOYEE FROM USER HERON

To Check what permissions you have within the database

SELECT * FROM SYSCAT.DBAUTH WHERE GRANTEE USER AND GRANTEETYPE 'U'

SELECT * FROM SYSCAT.COLAUTH WHERE GRANTOR = USER

At a minimum, you should consider restricting access to the SYSCAT.DBAUTH, SYSCAT.TABAUTH, SYSCAT.PACKAGEAUTH, SYSCAT.INDEXAUTH, SYSCAT.COLAUTH, and SYSCAT.SCHEMAAUTH catalog views. This would prevent information on user privileges, which could be used to target an authorization name for break-in, becoming available to everyone with access to the database. The following statement makes the view available to every authorization name:


GRANT SELECT ON TABLE MYSELECTS TO PUBLIC

And finally, remember to revoke SELECT privilege on the base table:


REVOKE SELECT ON TABLE SYSCAT.TABAUTH FROM PUBLIC

______________________________________

AVANT de poster votre message, veuillez lire, comprendre, et appliquer notre réglement
0
Rejoignez-nous