I have a need to allow users select permission depending upon
a flag and userid. Is it possible to do it on the server instead of on clien
t?
Because using 'Access front end', I am unable to restrict table view to
secured records. However, I am able to restrict the view using forms.
Thanks for your help in advance!
-MeConsider creating SQL Server views with option VIEW_METADATA. This will
limit users to only data exposed by the views and Access won't try to access
the underlying tables directly.
Hope this helps.
Dan Guzman
SQL Server MVP
"Me" <Me@.discussions.microsoft.com> wrote in message
news:B781CADF-9100-4295-937D-87383BA4954B@.microsoft.com...
>I have a need to allow users select permission depending upon
> a flag and userid. Is it possible to do it on the server instead of on
> client?
> Because using 'Access front end', I am unable to restrict table view to
> secured records. However, I am able to restrict the view using forms.
> Thanks for your help in advance!
> -Me
>|||Dan,
Its a great idea, I will implement it in some cases. However, what do I do
when I have to add/modify the data? If I don't link the table directly, I
won't be able to save data.
Here is my situation. I have a table say 'Tally', only admin/s are allowed
to create records in this table. It has a flag indicating if a particular
record in 'Tally' is confidential. If so, all users aren't allowed to view
this record. Only users associated with particular 'Tally' can view/modify
records. Information about who can access is stored in another table which i
s
linked to 'Tally' with a key.
As far as viewing of the data is concerned your idea of creating a view will
work
fine. But if users have to modify the record, they will need access to the
table.
Any ideas?
Appreciate your help!
-Me
"Dan Guzman" wrote:
> Consider creating SQL Server views with option VIEW_METADATA. This will
> limit users to only data exposed by the views and Access won't try to acce
ss
> the underlying tables directly.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Me" <Me@.discussions.microsoft.com> wrote in message
> news:B781CADF-9100-4295-937D-87383BA4954B@.microsoft.com...
>
>|||> As far as viewing of the data is concerned your idea of creating a view
> will
> work
> fine. But if users have to modify the record, they will need access to the
> table.
> Any ideas?
You ought to be able to modify data via the view as long as only one base
table is affected. For modifications via Access, I believe you also need to
identify the unique column(s) to Access so that it can construct the needed
SQL.
Hope this helps.
Dan Guzman
SQL Server MVP
"Me" <Me@.discussions.microsoft.com> wrote in message
news:5861EBE1-670C-4687-B8DF-13D264443643@.microsoft.com...[vbcol=seagreen]
> Dan,
> Its a great idea, I will implement it in some cases. However, what do I do
> when I have to add/modify the data? If I don't link the table directly, I
> won't be able to save data.
> Here is my situation. I have a table say 'Tally', only admin/s are
> allowed
> to create records in this table. It has a flag indicating if a particular
> record in 'Tally' is confidential. If so, all users aren't allowed to view
> this record. Only users associated with particular 'Tally' can view/modify
> records. Information about who can access is stored in another table which
> is
> linked to 'Tally' with a key.
> As far as viewing of the data is concerned your idea of creating a view
> will
> work
> fine. But if users have to modify the record, they will need access to the
> table.
> Any ideas?
> Appreciate your help!
> -Me
> "Dan Guzman" wrote:
>
Showing posts with label userid. Show all posts
Showing posts with label userid. Show all posts
Sunday, March 11, 2012
conditional reading of data ...
Saturday, February 25, 2012
Conditional Constraint - HowTo
In the table below:
===========
Roles
===========
UserID (int)
GroupID
===========
Considering that UserID is FK from Users Table and GroupID is FK from Groups
Table:
===========
Groups
===========
GroupID (int)
GroupName
===========
===========
Users
===========
UserID
Username
Password
Email
===========
And considering a User can have 0 or many Roles, exs:
Roles table
===========
1,1
1,2
1,3
===========
Meaning that this user have roles: 1,2,3
The problem is that I can have also:
Roles table
===========
1,1
1,1
1,1
===========
which is bad, so I need to have a constraint in the Roles table to force Gro
upID Unique ONLY in case UserID is already there!
Is it possible?I isn't this just a matter of letting both columns be the primary key?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> In the table below:
> ===========
> Roles
> ===========
> UserID (int)
> GroupID
> ===========
> Considering that UserID is FK from Users Table and GroupID is FK from Grou
ps Table:
> ===========
> Groups
> ===========
> GroupID (int)
> GroupName
> ===========
>
> ===========
> Users
> ===========
> UserID
> Username
> Password
> Email
> ===========
> And considering a User can have 0 or many Roles, exs:
> Roles table
> ===========
> 1,1
> 1,2
> 1,3
> ===========
> Meaning that this user have roles: 1,2,3
>
> The problem is that I can have also:
> Roles table
> ===========
> 1,1
> 1,1
> 1,1
> ===========
> which is bad, so I need to have a constraint in the Roles table to force GroupID U
nique ONLY in
case UserID is already there!
> Is it possible?|||Hum, but then I believe there′ll be just 1 role per user?
"Tibor Karaszi" wrote:
> I isn't this just a matter of letting both columns be the primary key?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> case UserID is already there!
>
>|||No, this enforces that you cannot have a duplicate of the *combination* of t
he columns. So, below is
fine:
1,2
1,3
2,2
2,3
Below is not fine:
1,2
1,2
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...[vbcol=seagreen]
> Hum, but then I believe therell be just 1 role per user?
> "Tibor Karaszi" wrote:
>
in[vbcol=seagreen]|||Actually your Right! Sorry for misunderstanding and thanks very much for the
quick response :-)
"Tibor Karaszi" wrote:
> No, this enforces that you cannot have a duplicate of the *combination* of
the columns. So, below is
> fine:
> 1,2
> 1,3
> 2,2
> 2,3
>
> Below is not fine:
> 1,2
> 1,2
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...
> in
>
>|||We all lose ourselves from time to time. Glad it helped. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:60CD2318-C000-4EC4-9C76-992096AD5F71@.microsoft.com...[vbcol=seagreen]
> Actually your Right! Sorry for misunderstanding and thanks very much for t
he quick response :-)
> "Tibor Karaszi" wrote:
>
below is[vbcol=seagreen]
ONLY[vbcol=seagreen]
===========
Roles
===========
UserID (int)
GroupID
===========
Considering that UserID is FK from Users Table and GroupID is FK from Groups
Table:
===========
Groups
===========
GroupID (int)
GroupName
===========
===========
Users
===========
UserID
Username
Password
===========
And considering a User can have 0 or many Roles, exs:
Roles table
===========
1,1
1,2
1,3
===========
Meaning that this user have roles: 1,2,3
The problem is that I can have also:
Roles table
===========
1,1
1,1
1,1
===========
which is bad, so I need to have a constraint in the Roles table to force Gro
upID Unique ONLY in case UserID is already there!
Is it possible?I isn't this just a matter of letting both columns be the primary key?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> In the table below:
> ===========
> Roles
> ===========
> UserID (int)
> GroupID
> ===========
> Considering that UserID is FK from Users Table and GroupID is FK from Grou
ps Table:
> ===========
> Groups
> ===========
> GroupID (int)
> GroupName
> ===========
>
> ===========
> Users
> ===========
> UserID
> Username
> Password
> ===========
> And considering a User can have 0 or many Roles, exs:
> Roles table
> ===========
> 1,1
> 1,2
> 1,3
> ===========
> Meaning that this user have roles: 1,2,3
>
> The problem is that I can have also:
> Roles table
> ===========
> 1,1
> 1,1
> 1,1
> ===========
> which is bad, so I need to have a constraint in the Roles table to force GroupID U
nique ONLY in
case UserID is already there!
> Is it possible?|||Hum, but then I believe there′ll be just 1 role per user?
"Tibor Karaszi" wrote:
> I isn't this just a matter of letting both columns be the primary key?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> case UserID is already there!
>
>|||No, this enforces that you cannot have a duplicate of the *combination* of t
he columns. So, below is
fine:
1,2
1,3
2,2
2,3
Below is not fine:
1,2
1,2
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...[vbcol=seagreen]
> Hum, but then I believe therell be just 1 role per user?
> "Tibor Karaszi" wrote:
>
in[vbcol=seagreen]|||Actually your Right! Sorry for misunderstanding and thanks very much for the
quick response :-)
"Tibor Karaszi" wrote:
> No, this enforces that you cannot have a duplicate of the *combination* of
the columns. So, below is
> fine:
> 1,2
> 1,3
> 2,2
> 2,3
>
> Below is not fine:
> 1,2
> 1,2
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...
> in
>
>|||We all lose ourselves from time to time. Glad it helped. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:60CD2318-C000-4EC4-9C76-992096AD5F71@.microsoft.com...[vbcol=seagreen]
> Actually your Right! Sorry for misunderstanding and thanks very much for t
he quick response :-)
> "Tibor Karaszi" wrote:
>
below is[vbcol=seagreen]
ONLY[vbcol=seagreen]
Labels:
belowrolesuserid,
conditional,
constraint,
database,
groupid,
groupidconsidering,
int,
microsoft,
mysql,
oracle,
server,
sql,
table,
userid,
users
Conditional Constraint - HowTo
In the table below:
===========
Roles
===========
UserID (int)
GroupID
===========
Considering that UserID is FK from Users Table and GroupID is FK from Groups Table:
===========
Groups
===========
GroupID (int)
GroupName
===========
===========
Users
===========
UserID
Username
Password
Email
===========
And considering a User can have 0 or many Roles, exs:
Roles table
===========
1,1
1,2
1,3
===========
Meaning that this user have roles: 1,2,3
The problem is that I can have also:
Roles table
===========
1,1
1,1
1,1
===========
which is bad, so I need to have a constraint in the Roles table to force GroupID Unique ONLY in case UserID is already there!
Is it possible?
I isn't this just a matter of letting both columns be the primary key?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> In the table below:
> ===========
> Roles
> ===========
> UserID (int)
> GroupID
> ===========
> Considering that UserID is FK from Users Table and GroupID is FK from Groups Table:
> ===========
> Groups
> ===========
> GroupID (int)
> GroupName
> ===========
>
> ===========
> Users
> ===========
> UserID
> Username
> Password
> Email
> ===========
> And considering a User can have 0 or many Roles, exs:
> Roles table
> ===========
> 1,1
> 1,2
> 1,3
> ===========
> Meaning that this user have roles: 1,2,3
>
> The problem is that I can have also:
> Roles table
> ===========
> 1,1
> 1,1
> 1,1
> ===========
> which is bad, so I need to have a constraint in the Roles table to force GroupID Unique ONLY in
case UserID is already there!
> Is it possible?
|||Hum, but then I believe there′ll be just 1 role per user?
"Tibor Karaszi" wrote:
> I isn't this just a matter of letting both columns be the primary key?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> case UserID is already there!
>
>
|||No, this enforces that you cannot have a duplicate of the *combination* of the columns. So, below is
fine:
1,2
1,3
2,2
2,3
Below is not fine:
1,2
1,2
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...[vbcol=seagreen]
> Hum, but then I believe therell be just 1 role per user?
> "Tibor Karaszi" wrote:
in[vbcol=seagreen]
|||Actually your Right! Sorry for misunderstanding and thanks very much for the quick response :-)
"Tibor Karaszi" wrote:
> No, this enforces that you cannot have a duplicate of the *combination* of the columns. So, below is
> fine:
> 1,2
> 1,3
> 2,2
> 2,3
>
> Below is not fine:
> 1,2
> 1,2
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...
> in
>
>
|||We all lose ourselves from time to time. Glad it helped. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:60CD2318-C000-4EC4-9C76-992096AD5F71@.microsoft.com...[vbcol=seagreen]
> Actually your Right! Sorry for misunderstanding and thanks very much for the quick response :-)
> "Tibor Karaszi" wrote:
below is[vbcol=seagreen]
ONLY[vbcol=seagreen]
===========
Roles
===========
UserID (int)
GroupID
===========
Considering that UserID is FK from Users Table and GroupID is FK from Groups Table:
===========
Groups
===========
GroupID (int)
GroupName
===========
===========
Users
===========
UserID
Username
Password
===========
And considering a User can have 0 or many Roles, exs:
Roles table
===========
1,1
1,2
1,3
===========
Meaning that this user have roles: 1,2,3
The problem is that I can have also:
Roles table
===========
1,1
1,1
1,1
===========
which is bad, so I need to have a constraint in the Roles table to force GroupID Unique ONLY in case UserID is already there!
Is it possible?
I isn't this just a matter of letting both columns be the primary key?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> In the table below:
> ===========
> Roles
> ===========
> UserID (int)
> GroupID
> ===========
> Considering that UserID is FK from Users Table and GroupID is FK from Groups Table:
> ===========
> Groups
> ===========
> GroupID (int)
> GroupName
> ===========
>
> ===========
> Users
> ===========
> UserID
> Username
> Password
> ===========
> And considering a User can have 0 or many Roles, exs:
> Roles table
> ===========
> 1,1
> 1,2
> 1,3
> ===========
> Meaning that this user have roles: 1,2,3
>
> The problem is that I can have also:
> Roles table
> ===========
> 1,1
> 1,1
> 1,1
> ===========
> which is bad, so I need to have a constraint in the Roles table to force GroupID Unique ONLY in
case UserID is already there!
> Is it possible?
|||Hum, but then I believe there′ll be just 1 role per user?
"Tibor Karaszi" wrote:
> I isn't this just a matter of letting both columns be the primary key?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:131352F2-272C-4666-95A2-E153FB2C4932@.microsoft.com...
> case UserID is already there!
>
>
|||No, this enforces that you cannot have a duplicate of the *combination* of the columns. So, below is
fine:
1,2
1,3
2,2
2,3
Below is not fine:
1,2
1,2
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...[vbcol=seagreen]
> Hum, but then I believe therell be just 1 role per user?
> "Tibor Karaszi" wrote:
in[vbcol=seagreen]
|||Actually your Right! Sorry for misunderstanding and thanks very much for the quick response :-)
"Tibor Karaszi" wrote:
> No, this enforces that you cannot have a duplicate of the *combination* of the columns. So, below is
> fine:
> 1,2
> 1,3
> 2,2
> 2,3
>
> Below is not fine:
> 1,2
> 1,2
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "KenA" <KenA@.discussions.microsoft.com> wrote in message
> news:7BF6E135-7CE1-4370-BF78-51032E0D8AFB@.microsoft.com...
> in
>
>
|||We all lose ourselves from time to time. Glad it helped. :-)
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"KenA" <KenA@.discussions.microsoft.com> wrote in message
news:60CD2318-C000-4EC4-9C76-992096AD5F71@.microsoft.com...[vbcol=seagreen]
> Actually your Right! Sorry for misunderstanding and thanks very much for the quick response :-)
> "Tibor Karaszi" wrote:
below is[vbcol=seagreen]
ONLY[vbcol=seagreen]
Labels:
belowrolesuserid,
conditional,
constraint,
database,
groupid,
groupidconsidering,
int,
microsoft,
mysql,
oracle,
server,
sql,
table,
userid,
users
Subscribe to:
Posts (Atom)