本文整理汇总了C#中IIdentity.IsInRole方法的典型用法代码示例。如果您正苦于以下问题:C# IIdentity.IsInRole方法的具体用法?C# IIdentity.IsInRole怎么用?C# IIdentity.IsInRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IIdentity
的用法示例。
在下文中一共展示了IIdentity.IsInRole方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: write_posts
///////////////////////////////////////////////////////////////////////
public static int write_posts(DataSet ds_posts, HttpResponse Response, int bugid, int permission_level, bool write_links, bool images_inline, bool history_inline, bool internal_posts, IIdentity identity)
{
if (Util.get_setting("ForceBordersInEmails","0") == "1")
{
Response.Write ("\n<table id='posts_table' border=1 cellpadding=0 cellspacing=3>");
}
else
{
Response.Write ("\n<table id='posts_table' border=0 cellpadding=0 cellspacing=3>");
}
int post_cnt = ds_posts.Tables[0].Rows.Count;
int bp_id;
int prev_bp_id = -1;
foreach (DataRow dr in ds_posts.Tables[0].Rows)
{
if (!internal_posts)
{
if ((int)dr["bp_hidden_from_external_users"] == 1)
{
continue;
}
}
bp_id = (int) dr["bp_id"];
if ((string)dr["bp_type"] == "update")
{
string comment = (string) dr["bp_comment"];
if (identity.GetTagsFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed tags from"))
continue;
if (identity.GetProjectFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed project from"))
continue;
if (identity.GetOrgFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed organization from"))
continue;
if (identity.GetCategoryFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed category from"))
continue;
if (identity.GetPriorityFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed priority from"))
continue;
if (identity.GetAssignedToFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed assigned_to from"))
continue;
if (identity.GetStatusFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed status from"))
continue;
if (identity.GetUdfFieldPermissionLevel() == PermissionLevel.None
&& comment.StartsWith("changed " + Util.get_setting("UserDefinedBugAttributeName","YOUR ATTRIBUTE") + " from"))
continue;
}
if (bp_id == prev_bp_id)
{
// show another attachment
write_email_attachment(Response, bugid, dr, write_links, images_inline);
}
else
{
// show the comment and maybe an attachment
if (prev_bp_id != -1) {
Response.Write ("\n</table>"); // end the previous table
}
write_post(Response, bugid, permission_level, dr, bp_id, write_links, images_inline,
identity.IsInRole(BtnetRoles.Admin),
identity.GetCanEditAndDeletePosts(),
identity.GetIsExternalUser());
if (Convert.ToString(dr["ba_file"]) != "") // intentially "ba"
{
write_email_attachment(Response, bugid, dr, write_links, images_inline);
}
prev_bp_id = bp_id;
}
}
if (prev_bp_id != -1)
//.........这里部分代码省略.........