Hello,
in my web application, I have to create permissions for each user. So
what I am doing is that for each role (using sqlmembership in .net) I
am creating a column in the database to hold a group of permissions
which I will then do some 'bit banging' in my web application to see
if the permission is set or not.
An int is 32 bits, and a long is 64.
I guess making the data type a long is smarter since it doesn't take
that much more space in the database, and it gives me 64 instead of 32
possible permissions correct?
What datatype in sql server would a long map too? And int is an int,
but long? 6 3245
DotNetNewbie wrote:
in my web application, I have to create permissions for each user. So
what I am doing is that for each role (using sqlmembership in .net) I
am creating a column in the database to hold a group of permissions
which I will then do some 'bit banging' in my web application to see
if the permission is set or not.
An int is 32 bits, and a long is 64.
I guess making the data type a long is smarter since it doesn't take
that much more space in the database, and it gives me 64 instead of 32
possible permissions correct?
What datatype in sql server would a long map too? And int is an int,
but long?
A C# long matches a SQLServer bigint.
You could use bitmaps as described.
But it is not a very relational way of storing data.
Arne
On Dec 28, 9:46*pm, Arne Vajhøj <a...@vajhoej.d kwrote:
DotNetNewbie wrote:
in my web application, I have to create permissions for each user. *So
what I am doing is that for each role (using sqlmembership in .net) I
am creating a column in the database to hold a group of permissions
which I will then do some 'bit banging' in my web application to see
if the permission is set or not.
An int is 32 bits, and a long is 64.
I guess making the data type a long is smarter since it doesn't take
that much more space in the database, and it gives me 64 instead of 32
possible permissions correct?
What datatype in sql server would a long map too? *And int is an int,
but long?
A C# long matches a SQLServer bigint.
You could use bitmaps as described.
But it is not a very relational way of storing data.
Arne
Yeah, that is the downside.
For example, if I wanted to do a SQL query for all users with a
particular permission, I'm guessing it would result in a complete
table scan.
ie. select * from users where permissions = (permissions & 0x02) (or
something like that).
One option would be to store each permission in a seperate table, and
then create a 'summary column' in the users table, this way I don't
have to do seperate queries for each user in my web application.
It probably will result in a table scan, which isn't going to help you
much.
Why not have one table which has the definitions of the permissions, and
then another which has the permissions that are assigned to the appropriate
user? That way, you can have as many permissions as you need, and to be
quite honest, it's much easier to query and process in querying the
permissions (it's just two joins, and you just cycle through the permissions
in the client side code).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"DotNetNewb ie" <sn***********@ yahoo.comwrote in message
news:7e******** *************** ***********@d21 g2000prf.google groups.com...
On Dec 28, 9:46 pm, Arne Vajhøj <a...@vajhoej.d kwrote:
DotNetNewbie wrote:
in my web application, I have to create permissions for each user. So
what I am doing is that for each role (using sqlmembership in .net) I
am creating a column in the database to hold a group of permissions
which I will then do some 'bit banging' in my web application to see
if the permission is set or not.
An int is 32 bits, and a long is 64.
I guess making the data type a long is smarter since it doesn't take
that much more space in the database, and it gives me 64 instead of 32
possible permissions correct?
What datatype in sql server would a long map too? And int is an int,
but long?
A C# long matches a SQLServer bigint.
You could use bitmaps as described.
But it is not a very relational way of storing data.
Arne
Yeah, that is the downside.
For example, if I wanted to do a SQL query for all users with a
particular permission, I'm guessing it would result in a complete
table scan.
ie. select * from users where permissions = (permissions & 0x02) (or
something like that).
One option would be to store each permission in a seperate table, and
then create a 'summary column' in the users table, this way I don't
have to do seperate queries for each user in my web application.
On Dec 29, 9:55 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
It probably will result in a table scan, which isn't going to help you
much.
Why not have one table which has the definitions of the permissions, and
then another which has the permissions that are assigned to the appropriate
user? That way, you can have as many permissions as you need, and to be
quite honest, it's much easier to query and process in querying the
permissions (it's just two joins, and you just cycle through the permissions
in the client side code).
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om
"DotNetNewb ie" <snowman908...@ yahoo.comwrote in message
news:7e******** *************** ***********@d21 g2000prf.google groups.com...
On Dec 28, 9:46 pm, Arne Vajhøj <a...@vajhoej.d kwrote:
DotNetNewbie wrote:
in my web application, I have to create permissions for each user. So
what I am doing is that for each role (using sqlmembership in .net) I
am creating a column in the database to hold a group of permissions
which I will then do some 'bit banging' in my web application to see
if the permission is set or not.
An int is 32 bits, and a long is 64.
I guess making the data type a long is smarter since it doesn't take
that much more space in the database, and it gives me 64 instead of 32
possible permissions correct?
What datatype in sql server would a long map too? And int is an int,
but long?
A C# long matches a SQLServer bigint.
You could use bitmaps as described.
But it is not a very relational way of storing data.
Arne
Yeah, that is the downside.
For example, if I wanted to do a SQL query for all users with a
particular permission, I'm guessing it would result in a complete
table scan.
ie. select * from users where permissions = (permissions & 0x02) (or
something like that).
One option would be to store each permission in a seperate table, and
then create a 'summary column' in the users table, this way I don't
have to do seperate queries for each user in my web application.
Nicholas,
The problem with that approach is that if I applying/checking for
permissions from INSIDE a stored procedure, it makes the subquery much
more combersome (as oppose to it being a simple bit check).
So you go back to having to remember what the values are for the
enumeration,
Just an aside; when you *do* have bitwise flags columns (which should
be rare), I find that the extended properties in SQL Server (such as
MS_Description) are a good place to note down what each bit means...
that way it will show automatically in a number of tools, and is
queryable via TSQL
Marc
On Jan 7, 3:23 am, "Marc Gravell" <marc.grav...@g mail.comwrote:
So you go back to having to remember what the values are for the
enumeration,
Just an aside; when you *do* have bitwise flags columns (which should
be rare), I find that the extended properties in SQL Server (such as
MS_Description) are a good place to note down what each bit means...
that way it will show automatically in a number of tools, and is
queryable via TSQL
Marc
Ok if I store the permissions in a normalized database way, how will I
be referencing the columns in my code.
ideally I want to do something like:
Permissions[userRoleID].AllowRead
Will I just have to map my class to the permissions table, or is there
a dynamic way of doing things? I could use a hashtable, that way I
won't have to keep updating my codebase when a new permission is
created...thoug hts? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bart plessers |
last post by:
Hello,
For a while I am working with ThumbsPlus ( http://www.cerious.com/ ) as
manager for pics.
The benefit of the program is that it stores all kind of information in a
central Microsoft Database that easily can be manipulated.
A thumbnail of the picture is also stored in de MDB as long binary (jpeg
format)
I made a small script that...
|
by: bart plessers |
last post by:
Hello,
For a while I am working with ThumbsPlus ( http://www.cerious.com/ ) as
manager for pics.
The benefit of the program is that it stores all kind of information in a
central Microsoft Database that easily can be manipulated.
A thumbnail of the picture is also stored in de MDB as long binary (jpeg
format)
I made a small script that...
|
by: travelling_nerd |
last post by:
Hi,
I'm trying to write a script that will allow validated users to
download a file that has specific ntfs permissions. Here's a summary:
Scenario:
1) The name of the file is "binary.zip".
2) I've created a local account on the server called "dl_user".
3) dl_user is the only account that has permissions on binary.zip.
4) I've written a...
|
by: Randy |
last post by:
I have heard that access 2003 has functions for dealing with Long
Binary Data. Does anyone know if this is true?
Background:
I am using 2000 with a table linked to a SQL server. One of the fields
is of type OLE Object. This table is populated from a website where
excell spreadsheets are uploaded. But in the linked Access table
instead of...
|
by: Jerry |
last post by:
I have an off-the-shelf app that uses an Access database as its
backend. One of the tables contains a field with an "OLE Object"
datatype. I'm writing some reports against this database, and I
believe this field contains data I need. When I view the table in
datasheet view, all I can see in this field is the string "Long
binary data".
...
| |
by: Jens Mittag |
last post by:
Hi!
In my code, I have an array of a structure, which I want to save to a
binary file. When the array is just created, everything works fine, but
when I change contents of the array, saving results in a file, which
doesn't hold the information of the changed array anymore. I dont know why.
Here is the code:
/*
|
by: Marc Gravell |
last post by:
Short version: is it possible to control the endian-ness of BitConverter? -
or are there any /framework/ methods like
BigEndianBitConverter.GetBytes(long) and .ToInt64()?
(I am not after equivalent code; I already have that)
===
Background:
I'm dealing with Sql-Server timestamp fields ; in some circumstances (e.g. OpenXml) they need to...
|
by: S Wheeler |
last post by:
Hi All -
I am creating a upgrade utility that transfers an bin / exe image over an
xml stream. But I can not seem to get the deserialization of the binary
field to work correctly. What I have is a base 64 encoded field but when I
try to deserialize, I throw an XML / reflection exception. However, if I
remove the base64 (m_Data) stuff...
|
by: fermineutron |
last post by:
For a while now i have been "playing" with a little C program to
compute the factorial of large numbers. Currently it takes aboy 1
second per 1000 multiplications, that is 25000P1000 will take about a
second. It will be longer for 50000P1000 as expected, since more digits
will be in the answer. Now, on the Num Analyses forum/Group there is a...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| | |