BWG
  •  BWG
  • 99.4% (Exalted)
  • YAF Lover Topic Starter
2010-04-17T03:39:15Z
At database level, how do you determine if a user has host admin level access? I read somewhere that if the Flags field in the yaf_User table is set to 3 the user has host admin access. Can anyone:

1) Confirm if this is the case?
2) Tell me if a stored procedure exists which accepts username as a parameter and checks whether that user is a host admin?

Thanks

BWG
Sponsor
BWG
  •  BWG
  • 99.4% (Exalted)
  • YAF Lover Topic Starter
2010-04-18T03:55:37Z
Figured this out myself. :oops:

I've got another asp.net wich the host admin of my forum needs admin level access to. So in the asp.net the user logs in and then needs to be validated against YAF to check for Host Admin status.

1) I've modified the web.config to use the YafRoleProvider and YafMembershipProvider to get users logging into my asp.net app with their YAF credentials.

2) In my asp.net app I'ved added in references to the Yaf dlls, and then used this code to check for host admin status

bool boolAdmin = false;
int currentUserID = (int) YafContext.Current.PageUserID;

using (DataTable dt = DB.user_list(1, currentUserID, null))
{
DataRow row = dt.Rows[0];
var userFlags = new UserFlags(row["Flags"]);
boolAdmin = userFlags.IsHostAdmin;
}

Very easy to set up, and offers the level of integration I need. 😁
shide
  •  shide
  • 80.6% (Honored)
  • YAF Lover
2014-03-28T11:00:17Z
Thanx for your post, it helped.

However, in YAF version 2.1.1 you can find out if a user is host admin or not by calling

YafContext.Current.IsHostAdmin


Hope this will help ! 😮
Wasonever
2014-04-02T09:06:51Z
hi
Evening news is where they begin with ‘Good evening’, and then proceed to tell you why it isn’t.

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved