protected void RemoveGroupButton_Click(object sender, EventArgs e) { NetTelcoUserRepository RemoveUserInGroup = new NetTelcoUserRepository(); RemoveUserInGroup.RemoveUserInAccessGroup(Convert.ToInt64(AllowedGroups.SelectedValue.ToString())); AllowedGroups.DataBind(); NotAllowedGroups.DataBind(); }
protected void AddGroupButton_Click(object sender, EventArgs e) { NetTelcoUserRepository AddUserInGroup = new NetTelcoUserRepository(); AddUserInGroup.AddUserInAccessGroup(Convert.ToInt64(UsersEditGridView.SelectedValue.ToString()), Convert.ToInt64(NotAllowedGroups.SelectedValue.ToString())); AllowedGroups.DataBind(); NotAllowedGroups.DataBind(); }
public virtual void AddAllowedGroup(int enviromentId, string groupId) { if (AllowedGroups.Count(x => x.EnviromentId == enviromentId && x.GroupId == groupId) == 0) { AllowedGroups.Add(new AllowedGroup() { ApplicationId = this.Id, EnviromentId = enviromentId, GroupId = groupId }); } }
public bool HasPermissionToBuildInRegion(TSPlayer ply) { if (!ply.IsLoggedIn) { if (!ply.HasBeenNaggedAboutLoggingIn) { ply.SendMessage("You must be logged in to take advantage of protected regions.", Color.Red); ply.HasBeenNaggedAboutLoggingIn = true; } return(false); } if (!DisableBuild) { return(true); } return(AllowedIDs.Contains(ply.User.ID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.User.Name); }
/// <summary> /// Removes a group's access to the region /// </summary> /// <param name="groupName">Group name to remove</param> /// <returns></returns> public bool RemoveGroup(string groupName) { return(AllowedGroups.Remove(groupName)); }
/// <summary> /// Checks if a given player has permission to build in the region /// </summary> /// <param name="ply">Player to check permissions with</param> /// <returns>Whether the player has permission</returns> public bool HasPermissionToBuildInRegion(TSPlayer ply) { if (!DisableBuild) { return(true); } if (!ply.IsLoggedIn) { if (!ply.HasBeenNaggedAboutLoggingIn) { ply.SendMessage("登录后才能使用此被保护的区域.", Color.Red); ply.HasBeenNaggedAboutLoggingIn = true; } return(false); } return(ply.HasPermission(Permissions.editregion) || AllowedIDs.Contains(ply.User.ID) || AllowedGroups.Contains(ply.Group.Name) || Owner == ply.User.Name); }
protected internal virtual void LoadDefaultPermissions() { AllowedGroups.Add("server.default"); }