How to check user role membership?

Is it possible to determine the user roles for a login other
than oneself?  sp_displayroles works, of course, but I want to
do something programmatically.  And select is, by default, denied
on the role tables even when logged in as SSO.

Basically, I want to do something like:

if USERID is not granted to SOME_ROLE
    then do something

But I don't see any way to do this unless I'm logged in as USERID.

Thanks,
Mike
1
Mike
3/5/2002 7:14:11 PM
sybase.ase.administration 7058 articles. 2 followers. Follow

6 Replies
5220 Views

Similar Articles

[PageSpeed] 46

You can do check in the sysroles table 

if exists (select * from master.dbo.syssrvroles 
                                where name = @name)
0
xyz
3/5/2002 8:37:15 PM
Thanks but normal users can't do this because of the permissions
on systems tables.  I was hoping to do this without modifying the
default security settings but I'm starting to believe it's not
possible.

Mike
0
Mike
3/5/2002 8:44:15 PM
On Tue, 05 Mar 2002 12:44:15 -0800, Mike wrote:

> Thanks but normal users can't do this because of the permissions on
> systems tables.  I was hoping to do this without modifying the default
> security settings but I'm starting to believe it's not possible.

You should be able to accomplish that in a stored proc, provided the user
that *creates* the proc has the correct permissions. 

If you need to use the information from the query in another query you
may have to use OUTPUT parameters, or storing the data in an intermediate
table...

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org           *or*          mpeppler@mbay.net
http://www.mbay.net/~mpeppler
International Sybase User Group: http://www.isug.com
0
Michael
3/5/2002 8:50:34 PM
> You should be able to accomplish that in a stored proc, provided the user
> that *creates* the proc has the correct permissions. 
>
> If you need to use the information from the query in another query you
> may have to use OUTPUT parameters, or storing the data in an intermediate
> table...

Thanks.  That's exactly what I've started doing e.g.
creating an sp which I've named sp__hasrole @name, @role.

By the way, what I am doing -- just in case I'm reinventing a
wheel or something -- is setting up a password reset mechanism
where the requirements are that users are grouped as follows:

System SSO's    -- can reset passwords for anybody 
System HelpDesk -- can reset passwords for anybody except SSO's

The way I'm setting it up now is not exactly foolproof because
in reality both groups will have Sybase SSO ability and if the
Help Desk users know enough Sybase can go in and reset passwords
outside of the interface I'm building.

If anybody has any tips or input I'm all ears.

Thanks,
Mike
0
Mike
3/5/2002 10:11:49 PM
You should consider using the proc_role and show_role functions.  The
distinction appears to be that the proc_role function calls can be audited.
This is not documented in the 12.0 Ref Manual, chapter 2.  The exact usages
of the functions also differs.  You'll probably want to use charindex with
show_role.

<Mike> wrote in message
news:6D0F470973C7C7D00079EE7185256B73.0077FB1D85256B73@webforums...
> > You should be able to accomplish that in a stored proc, provided the
user
> > that *creates* the proc has the correct permissions.
> >
> > If you need to use the information from the query in another query you
> > may have to use OUTPUT parameters, or storing the data in an
intermediate
> > table...
>
> Thanks.  That's exactly what I've started doing e.g.
> creating an sp which I've named sp__hasrole @name, @role.
>
> By the way, what I am doing -- just in case I'm reinventing a
> wheel or something -- is setting up a password reset mechanism
> where the requirements are that users are grouped as follows:
>
> System SSO's    -- can reset passwords for anybody
> System HelpDesk -- can reset passwords for anybody except SSO's
>
> The way I'm setting it up now is not exactly foolproof because
> in reality both groups will have Sybase SSO ability and if the
> Help Desk users know enough Sybase can go in and reset passwords
> outside of the interface I'm building.
>
> If anybody has any tips or input I'm all ears.
>
> Thanks,
> Mike


0
Carl
3/6/2002 12:53:15 PM
> You should consider using the proc_role and show_role 
> functions. The distinction appears to be that the proc_role 
> function calls can be audited. This is not documented in the 
> 12.0 Ref Manual, chapter 2. The exact usages of the functions 
> also differs. You'll probably want to use charindex with show_role. 

I didn't know that about the auditing, thanks.  Neither of these
functions will work for me because they only display role
info for the current user.  What I need to do is get role info
for other users.  I imagine Sybase doesn't provide this 
functionality because it may be considered a security breach if
users can look up role information for others.

Mike
0
Mike
3/6/2002 7:35:20 PM
Reply:

Similar Artilces:

Membership and Roles
Hi all, Is there a way to allow the user choose a role from a selection you provide them with? e.g. I have 3 types of users: admin, contractor, and landlord. Of course I don't want them to be able to assign themselves admin role, so how would I proceed? (I'm using C# by the way) This is what I have so far. Please note "Roles...();" is where I am stuck: -within my aspx page i have: <asp:WizardStep ID="CreateUserWizardStep2" runat="server" Title="Contractor or Landlord?"> <asp:ListBox ID="ListBox1" runat=&q...

Sending email to all users in Membership database / all users by role.
I am trying to send emails to ALL users in the membership database.  Right now i am using this VB code to send an email in a web form.   Can anyone help me with the code to send this message in the web form to everyone in my membership database? Or to all users in the database assigned to a specific ROLE? (Actually that would be better).   Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendEmail.Click Const ToAddress As String = "xxxj@xxxx.com,xxxx@xxxx.com,xxx@xxx.com" Dim mm As New MailMessage(UsersEmail.Text, ToAddress) ...

How to check windows group membership of a user other than the current user?
As the title suggests, I'm looking for a way to check Windows group/role membership for a user other than the current one. The WindowsPrincipal.IsInRole method seems to only check for the current user. Any suggestions appreciated. Alternatively, if I can take a windows logon name and get a full list of what SQL permissions they have been granted, that would work too. I have a situation where only Windows groups have logon entries in SQL - it works fine as far as connecting and using SQL goes, but I seem unable to get what permissions JoeBob has in SQL (not logged in as JoeBob, this ...

How do I check whether a user is in a role when the user is not yet authenticated
My problem:  Users coming through a portal are automatically authenticated as guests, using a standard password that nobody ever sees.   However they can also register as normal users, in which chase they have their individual password which they know, and the usual functions to reset their password, handle a forgotten password, and so on.So, in my register-from-portal code, after recognizing that this is a returning user we need to authenticate the user: but we don't know whether to use the standard portal password, or request an individual password.  I would like to writ...

Specific User -> Administrator Roles & Authorized Roles
Hi All, Has there been any discussion about setting up Administrator and Authorized Roles for, Tabs and Modules to based on a specific user? I think it would be handy to have a specific user control a specific module or tab. For example, let say I want UserABC to have edit control of the links module without creating a special role for that user. I would also see this being important if there is ever a file manager for specific users. For files they only have access to. -- Ingram ...

Membership and Role Management
Hello, I've configured SQL server 2005 as my back-end data store via aspnet_regsql.exe. I presume it was succesvol. Creating users en roles programmatically is no problem. When I start the Web Site Administration Tool I can see the created users and roles. But when I want to show them by code I get an empty result. ... ... Roles.GetAllRoles()...... membership.GetAllUsers() The roleManager is enabled in web.config.<roleManager defaultProvider="SqlProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSS...

Role for Group Administration only works if user/role has too much eDir rights
BlankL.S., Been searching for a TID that describes what rights are needed for a user/role to administer group membership. Finally found TID 10064960. We use groups there where rights go beyond context level (not a whole context or users from several contexts. Step 1 in this describes what we want. Step 2 gives to much rights, because we have to give it at almost the top level. Now our config: Edirectory 8.7.3.1 (planning to update to 8.7.3.2 very shortly) running on netware 5.1SP7 and 6.5SP1 platform. With only TID step 1 rights granted the following happens. After adding a u...

User Role membership
I have a manually made login page.  So far I have been able to get the user to login just fine but it doesn't see the roles that that user is apart of.  Here's the twist, (at least for me): When I put a watch on  Roles.GetRolesForUser("user") it shows that the login name is part of the correct group.  Yet if I put a watch on User.IsInRole("Users") it comes back false....  What gives????  I can't redirect based on membership until I figure this out! Just some clarification: User name is user user group that i am checking ...

How to check user role
I'm creating a module that I want to display certain things to specific roles. How do I check the roles of the currently logged in user? Sorry if this is a newb question but really not sure how this is done. ThanksCheersmidspot Hmm - you can use PortalSecurity.IsInRole to check if the logged on user is in a specific role or array of roles.. or                 RoleController roleController = new RoleController();                 roleController.GetUserRolesByUser...

Check user role
How do you check to see if a user is member of a particular role created in DNN? I've tried using: If PortalSecurity.IsInRole("Production") = True Then... and also If context.User.IsInRole("Production") = True Then... but neither of them seems to work. Weird thing is I believe one of the two code used to work but doesn't seem to. Thanks. I believe that IsInRole() takes the RoleId as a string parameter, not the RoleName.~ChrisNet Data Design706Horsman.us...

How to check if some user is in the role
Hi,I want to build Administration panel in which I could controll which users are in selected role. I'm writing it in ASP MVC, but it doesn't matter. First I'm checking is edited/managed role exist (if no I'm writing message): if (Roles.RoleExists(roleName)){ ViewData["Title"] = "Manage users in role: " +roleName; ViewData["roleName"] = roleName; MembershipUserCollection users = Membership.GetAllUsers(); return View(users);}  and in the view I want to show list of all users with checkbox indicating if user is in selected role. ...

Extending role, personalization and membership features when a user can assume multiple roles
I have a tracking project to work on and I intend to use VWDE for it.The salient features of the system is that a user can be a participant in multiple projects and he can assume different roles in different projects. He can, for example be an analyst in one project, a project manager in another and yet again, a tester in another one. Now, depending on what role he is in a project, he will be granted the appropriate privileges. For example, as a Project Manager, he can track the progress and view and approve documents submitted by members of his project team, but as an analyst, he can just s...

Check if user is in role
Hello,I need to check if a user with a certain username is in a specific role.This is not the current user which is logged on.How can I do this?Thanks,Miguel UserIsInRole();CheersAlMy BlogMapStats.NETPlease click on 'Mark as Answer' if this post answered your question! Visual Basic If User.IsInRole("members") Then buttonMembersArea.Visible = True End If C# if (User.IsInRole("members"))  { buttonMembersArea.Visible = True; You might want to have a look at this: http://msdn2.microsoft.com/en-us/library/5k850zwb.aspx...

ASP.net Membership API: Adding user's role while creating user.
Hi All, I'm trying to create a new user. I want to add the user's role while creating the user. So I need it to be somehow in some sort of a transaction. Also I require to save some extra information in a separate table. I don't seem to have any option of doing such a thing with SqlMembershipProvider. I just want to find out various ways I could do this. My code's attached below.MembershipCreateStatus membershipCreateStatus;MembershipUser membershipUser;// Create user recordmembershipUser = Membership.CreateUser(userName, password, email, securityQuestion, answer, false, out...

Web resources about - How to check user role membership? - sybase.ase.administration

Polish European Union membership referendum, 2003 - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Drivers of Facebook Shuttle Buses Eye Teamsters Membership
Facebook and several other tech companies in Silicon Valley provide shuttle buses to transport their employees, and according to The New York ...

NJ Membership (@NJMembership) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Membership Has Its Privileges
Right now, crossing one of the magical rep borders happens more or less unnoticed. People just gain the particular powers. Now, of course they ...

Membership Cards - a set on Flickr
... home Sign Up Explore Recent Photos The Commons Getty Collection Galleries World Map App Garden Camera Finder Flickr Blog Upload Sign In Membership ...

Calgary Public Library: New Look. New Library. Free Membership. - YouTube
CREATING THE WORLD’S BEST PUBLIC LIBRARY: NEW LOOK. NEW LIBRARY. FREE MEMBERSHIP. For Immediate Release: In a bold move to become the world’s ...

The benefits of private club membership in the UAE
Lifestyle membership clubs can offer cardholders exclusive leisure discounts across the Emirates. But there can be a big catch - you need to ...

New Brisbane Broncos CEO Paul White Flags Membership Drive
The coal executive taking over at the helm of the Brisbane Broncos has his eyes set on the thousands of fans who regularly turn up to home games ...

Joe Tripodi's ALP membership suspended
NSW ALP has suspended membership of Joe Tripodi amid a corruption inquiry.

Invite-only memberships expand at Canberra's sky-high lounge
... club &ndash; if they have been lucky enough to get an invite The 15th floor lounge billed as Canberra's most exclusive has quadrupled its membership ...

Resources last updated: 1/18/2016 9:49:31 AM