YAFLogo

BWG
  • BWG
  • 100% (Exalted)
  • YAF Lover Topic Starter
14 years ago
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
  • 100% (Exalted)
  • YAF Lover Topic Starter
14 years ago
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
10 years ago
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
10 years ago
hi
Evening news is where they begin with ā€˜Good eveningā€™, and then proceed to tell you why it isnā€™t.