public void btnAddUser_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(SelectedGroupName)) { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); var result = prmManager.AddUserToGroup(Context.User.Identity.Name, SelectedGroupName, txtAddUser.Text); switch (result) { case vwarDAL.PermissionErrorCode.AlreadyIncluded: case vwarDAL.PermissionErrorCode.AlreadyExists: lblErrorMessage.Text = "User already exists in group"; break; case vwarDAL.PermissionErrorCode.NotAuthorized: lblErrorMessage.Text = "You are not authorized to add users to this group"; break; case vwarDAL.PermissionErrorCode.DoesNotExist: break; case vwarDAL.PermissionErrorCode.OutOfRange: break; case vwarDAL.PermissionErrorCode.NotIncluded: break; case vwarDAL.PermissionErrorCode.Ok: SetSelectedGroupsUsers(SelectedGroupName); break; default: break; } prmManager.Dispose(); } }
/// <summary> /// Overrides API base class validate, uses website user rather than HTTP Basic /// </summary> /// <param name="type">The transaction type to validate</param> /// <param name="co">the content object to validate the operation on</param> /// <returns>True if the user may perform this operation on the contentobject</returns> public override bool DoValidate(Security.TransactionType type, string PID) { vwarDAL.PermissionsManager prm = new vwarDAL.PermissionsManager(); vwarDAL.ModelPermissionLevel Permission = prm.GetPermissionLevel(username, PID); prm.Dispose(); if (type == Security.TransactionType.Query && Permission >= vwarDAL.ModelPermissionLevel.Searchable) { return(true); } if (type == Security.TransactionType.Access && Permission >= vwarDAL.ModelPermissionLevel.Fetchable) { return(true); } if (type == Security.TransactionType.Modify && Permission >= vwarDAL.ModelPermissionLevel.Editable) { return(true); } if (type == Security.TransactionType.Delete && Permission >= vwarDAL.ModelPermissionLevel.Admin) { return(true); } if (type == Security.TransactionType.Create && Permission >= vwarDAL.ModelPermissionLevel.Admin) { return(true); } return(false); }
public void UsersPerGroup_RowDeleting(object sender, GridViewDeleteEventArgs e) { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); var selectedUser = CurrentUsers[e.RowIndex]; prmManager.RemoveUserFromGroup(Context.User.Identity.Name, SelectedGroupName, selectedUser); prmManager.Dispose(); }
public void bthDeleteGroup_Click(object sender, EventArgs e) { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); prmManager.DeleteGroup(Context.User.Identity.Name, bthDeleteGroup.CommandArgument); BindGroups(); var script = "window.setTimeout(function(){$('#deleteGroupDialog').dialog('close');},500);"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "closedeletegroup", script, true); prmManager.Dispose(); }
private void BindGroups() { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); CurrentUserGroups.DataSource = prmManager.GetGroupsByOwner(Context.User.Identity.Name); CurrentUserGroups.DataBind(); UsersPerGroup.DataSource = new List <String>(); UsersPerGroup.DataBind(); prmManager.Dispose(); }
private void SetSelectedGroupsUsers(string selectedGroup) { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); var data = prmManager.GetGroupsUsers(selectedGroup); UsersPerGroup.DataSource = data; CurrentUsers = data; UsersPerGroup.DataBind(); prmManager.Dispose(); }
public void CurrentUserGroups_SelectedIndexChanged(object sender, EventArgs e) { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); var selected = CurrentUserGroups.SelectedIndex; var grpLst = CurrentUserGroups.DataSource as vwarDAL.GroupList; var selectedGroup = grpLst[selected]; SelectedGroupName = selectedGroup.GroupName; SetSelectedGroupsUsers(SelectedGroupName); addUser.Enabled = true; prmManager.Dispose(); }
public void CurrentUserGroups_rowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteGroup") { int index = System.Convert.ToInt16(e.CommandArgument); UserGroup selectedGroup = ((GroupList)CurrentUserGroups.DataSource)[index]; vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); var script = "window.setTimeout(function(){document.ShowDeleteGroup('" + selectedGroup.GroupName + "');},500);"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "deletegroup", script, true); bthDeleteGroup.CommandArgument = selectedGroup.GroupName; bthDeleteGroup.Text = "Delete " + selectedGroup.GroupName; prmManager.Dispose(); } }
private void BindGroups() { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); GroupList g1 = prmManager.GetGroupsByOwner(Context.User.Identity.Name); GroupList g2 = prmManager.GetGroupsByAdministrator(Context.User.Identity.Name); foreach (UserGroup g in g2) { g1.Add(g); } CurrentUserGroups.DataSource = g1; CurrentUserGroups.DataBind(); UsersPerGroup.DataSource = new List <String>(); UsersPerGroup.DataBind(); prmManager.Dispose(); }
private void BindGroups() { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); CurrentUserGroups.DataSource = prmManager.GetGroupsByOwner(Context.User.Identity.Name); CurrentUserGroups.DataBind(); UsersPerGroup.DataSource = new List<String>(); UsersPerGroup.DataBind(); prmManager.Dispose(); }
public void CurrentUserGroups_rowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteGroup") { int index = System.Convert.ToInt16(e.CommandArgument); UserGroup selectedGroup = ((GroupList)CurrentUserGroups.DataSource)[index]; vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); var script = "window.setTimeout(function(){document.ShowDeleteGroup('" + selectedGroup.GroupName + "');},500);"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "deletegroup", script,true); bthDeleteGroup.CommandArgument = selectedGroup.GroupName; bthDeleteGroup.Text = "Delete " + selectedGroup.GroupName; prmManager.Dispose(); } }
private void BindGroups() { vwarDAL.PermissionsManager prmManager = new vwarDAL.PermissionsManager(); GroupList g1 = prmManager.GetGroupsByOwner(Context.User.Identity.Name); GroupList g2 = prmManager.GetGroupsByAdministrator(Context.User.Identity.Name); foreach (UserGroup g in g2) g1.Add(g); CurrentUserGroups.DataSource = g1; CurrentUserGroups.DataBind(); UsersPerGroup.DataSource = new List<String>(); UsersPerGroup.DataBind(); prmManager.Dispose(); }