Get user roles

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
GaryShelton
Posts: 8
Joined: Tue 22 Jan 2019 06:29

Get user roles

Post by GaryShelton » Thu 12 Dec 2019 06:36

How can I get the user's roles? I need to adjust the Select statements, as well as visibility properties for Vcl Form components for MariaDB depending on the users roles. MariaDB does not allow Select * when not all columns have select privileges. Or is there another way this is usually handled?

ViktorV
Devart Team
Posts: 2907
Joined: Wed 30 Jul 2014 07:16

Re: Get user roles

Post by ViktorV » Thu 12 Dec 2019 12:38

You can find the necessary information on getting get user roles by the link https://dev.mysql.com/doc/refman/8.0/en ... rants.html

GaryShelton
Posts: 8
Joined: Tue 22 Jan 2019 06:29

Re: Get user roles

Post by GaryShelton » Thu 12 Dec 2019 13:49

Sorry, question was not clear enough. Yes I can use the Show Grants statement, but what I am looking for is a way to do this in Delphi code. Something like if User.HasRole('Financial') then change select statement and set visibility for controls based on return value

ViktorV
Devart Team
Posts: 2907
Joined: Wed 30 Jul 2014 07:16

Re: Get user roles

Post by ViktorV » Fri 13 Dec 2019 10:12

MyDAC components don't have those properties. You may try implementing the required functionality yourself, for example, by sending requests to MySQL server and handling the response.

Post Reply